Replies: 7 comments
-
A few thoughts
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your answer, @danielcompton. In my case, the stateful stuff is manipulating an embedded YouTube player, so it can't be in the app-db. I believe taking from a port does block, so I'd receive the server data before doing any operations. Will look into |
Beta Was this translation helpful? Give feedback.
-
I'm wondering if this helps: https://github.com/Day8/re-frame/wiki/Talking-To-Servers ? Event handlers are:
And, in addition:
So, yes, you could put a
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarifications. I ended up going with a channel |
Beta Was this translation helpful? Give feedback.
-
That wouldn't be my recommended way of doing it. You want "state" in the one place. Another channel is really state in a second place. Have you read this Wiki page: https://github.com/Day8/re-frame/wiki/Bootstrap-An-Application Notice the "Scales Up" section. |
Beta Was this translation helpful? Give feedback.
-
There's an example of a subscription that triggers on one or more values in app-db, but can I trigger a handler when a value changes? I haven't seen an idiomatic re-frame example yet which is why I'm using the go block. I can also pass on the original parameters to the blocking handler to the new handler, which I can't think of a good way to do without the go block. Possibly storing some temporary state (e.g. |
Beta Was this translation helpful? Give feedback.
-
Hmm. I'm not sure you are thinking about this the right way. You don't want to trigger a handler when a value changes. You trigger event handlers when an event occurs. Ask yourself: what event causes the value to change? Then work out how to The event handler for I hope I'm helping here. |
Beta Was this translation helpful? Give feedback.
-
Is it ok to have a go block inside a handler?
My use case is a secretary handler that must wait for data from the server, then do some other stateful stuff. I'm planning to have something like
(go (<! loaded-from-server) (stateful-stuff!))
inside the secretary handler, since it's one of the first things that's run and must wait for the data.If this isn't idiomatic, please suggest a better method! Thanks for making re-frame.
Beta Was this translation helpful? Give feedback.
All reactions