This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Can someone explain when and why to use the auto-run parameter in reaction?
Alternatively, when and why should you use run!
instead of reaction
?
@danielcompton: I might be wrong, but I use run! for code which should run reactively and is outside of reagent component, usually top-level-form code which has some derefs and should be run in reaction to changes in those derefs
auto-run is related, when you create reactive piece of code (for example with run!), you want it to run once when code is executed, without it, the reactions inside would not be created/tracked, it would be just a dead piece of code
Cool, thanks!
a different view: reaction is a special function which “depends” on other reactions, this gives you direct acyclic graph of reactions, you want auto-run the reactions which are at the top (they don’t depend on any other reaction, just ratoms), normally this is hidden from you, because you are building inner reactions and the top reaction is created by reagent from components
Finally had the chance to test what @antishok suggested, and indeed run!
works where reaction
didn't. It's apparently perfect for my use case, where I want to call very side-effecty revalidate
on some other field as a response to a ratom
changing.
working on a reagent project now and worked on Om projects before, so cursors were a natural choice
If you reject cursors (good decision!), then an FRP approach like re-frame or zelkova might be a good choice. (I am the author of the former, and so hopelessly biased :-))
You don't have to
Both re-frame and zelkova encourge a single-source-of-truth
Remember that Hoplon was doing single-source-of-truth well before OM showed up (they call them stem cells)
right now what bothers me the most is that cursors don't seem to work so well in reagent
I'm not the best guy to ask about Cursors. I'll hand over to others.
But, its my understanding that they work fine.
I just spend a couple of hours looking at reframe and it seems it completely ignores URLs, that is, as the app state changes it doesn’t update the URL and vice-versa. Is that correct?
michaelr: I know about secretary and bidi and silk… they are only part of the picture, the wiring between those and the app state is far from trivial hence I was looking for a framework that does it, like EmberJS does.
Yeah, it seems there are none 😞
in the general picture of an SPA application updating the browser history is just a small piece, once you get it figured out it mostly goes out of your way
I have no idea how big or small it is, I never built one (and generally, I try to build as little as possible, that is, reuse as much as possible).
I personally like separation of concerns in this case, I want to be able to combine different libraries depending on app's current needs. Building one monolithic framework trying to solve everything is probably not justified. ClojureScript community is pretty small. But we will see in the future, maybe there will be big enough demand for ClojureScript’s Angulars, Embers or Meteors.
yes, newly it is now also integrated with timeline view, I forgot the name of the graph, but you can see colored functions as bars and depth of calls
@michaelr I use cursors in production and have had no problems with them. That said, I still prefer the re-frame pattern and recommend that approach if you are starting a new project :)
Only advice is if you do go with cursors, id recommend using a 100% cursor approach to access your data..instead of mixing cursors and also accessing your single atom directly. There is a bug that exists currently, but should be fixed in next reagent release.
actually I'm doing most updates by dispatching an event and then updating the single atom
The title is misleading. It says on-blur, but its just a bug with cursors (nothing to do with on blur)
Im not certain about whether or not you will be safe. I am not sure Dan has added his fix yet for that.
uhg... i'm an idiot. I've spent the last 5 hours trying to figure out why I can't get re-com to work properly, and only just thought it would be a great idea to look at the re-com css file I have in my assets folder. First line in the file: <!DOCTYPE html>
I downloaded the actual github page, and not the css file...
Yeah @lucien.knechtli, that wouldn't work, but don't feel bad. I'm sure you're not the first one to do that.
It would be great if, when you add a library dependency to your project, any additional resources included in that library could automatically be directed to the right place in your project.
We looked at various way to achieve this a while back but couldn't find a good one. The closest we got was lein-unpack-resources
but this didn’t allow you to specify WHERE to put them. You can see our thoughts on the matter here: https://github.com/Day8/re-com/blob/master/project.clj#L37-L48.
We have never got back to solving this one but it IS on the list.
Would be grateful for any good ideas for achieving this.
I'll put some thought into it and tell you if I come up with something