I am having a hard time implementing a concept the re-frame way: When a certain event
:foo is dispatched I want to check whether
:bar is already in the app-db and if not query it from the backend. I can't imagine how I am supposed to do that with pure events. I thought about writing an effect, but then again I am thinking I am maybe overcomplicating what I am about to do.
From what I am understanding I probably should write some fx, that checks for the data in the cache and fires the appropriate effect for retrieval if not. Correct?
Correct, only the first "fx" in your last messages should be replaced with "event handler".
Ah of course, thank you. :thumbsup:
Check out #kee-frame, which has an elegant solution for this using url-based routing and controllers
the other option is that the thing that dispatches
:foo can pass in the previous
:bar (or detect if it’s available)
A not obvious downside - it may become (un)available again when
:foo is handled.