Fork me on GitHub
#re-frame
<
2020-07-14
>
wegi12:07:43

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.

beders15:07:00

Check out #kee-frame, which has an elegant solution for this using url-based routing and controllers

wegi12:07:10

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?

p-himik12:07:31

Correct, only the first "fx" in your last messages should be replaced with "event handler".

wegi12:07:37

Ah of course, thank you. :thumbsup:

lilactown15:07:18

the other option is that the thing that dispatches :foo can pass in the previous :bar (or detect if it’s available)

p-himik15:07:56

A not obvious downside - it may become (un)available again when :foo is handled.