-
-
Notifications
You must be signed in to change notification settings - Fork 715
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaying events with side effects in handlers? #86
Comments
This looks more like a question than a feature/bug report. I'm closing this here, but feel free to discuss it further on a better channel for discussion, e.g. Clojurians Slack, ClojureScript mailing list, Reagent mailing list. Thanks! |
Did this lead to any interesting discussion somewhere? I don't find much documentation on best practices for handling side effects. |
As a general principle, side effects should always be initiated in handlers. Where there is a remote call, we have two (or three) handlers. The handler that makes the request, the handler that gets called on success, and the hanswer that gets called on error. |
I have been wondering about this as well, it's not a very nice practice that some handlers cause side effects and some don't. Let's consider a case where I have a user using my re-frame enabled application. Sometimes there are some issues and I want to be able to log all actions that the user has made and replay them locally without any side effects (the results of side effects are still in separate actions, which I do want to replay). Now if I do not know which actions cause side effects, it is impossible to filter those out. But unless I filter them out my local instance might start to make calls to the backend with that user's session and access my browser's local storage or cookies, which in turn might make reproducing the bug impossible. I don't think this is just a theoretical discussion, but a serious concern for anyone trying to store a side effect free stream of events. I've been thinking about this for a while, and I think what I probably would want is a I haven't written a proof-of-concept yet, so not completely sure if this is the sensible way to go. I also recommend reading the related blog post, even though I think the suggested solution there results in a bit unreadable code, and I wouldn't want to go with that. |
These are all great points, can you bring them up on the Reagent mailing list to discuss them further? |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I have just started playing with re-frame. And I wonder: how do you replay events if your event handlers have side effects (like HTTP requests following new dispatches)?
Or maybe I am missing something?
The text was updated successfully, but these errors were encountered: