-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix subscribe warnings #15
Conversation
@M-sleeper Thank you so much for taking the time to review an open issue and to submit a PR, I really appreciate it! It has been a while since I have written clojurescript or re-frame, so I am no longer current with best practices. Thank you for calling out the change from dispatch-sync to dispatch. In my opinion, honoring the guarantee that keypresses will be processed in synchronous order is more important than silencing the console warning for using the re-frame subscription incorrectly. I am comfortable with a few options on how to proceed:
|
@gadfly361 Thanks for the review. About 2. |
@M-sleeper thanks for the quick reply! Gotcha, makes sense that using app-db directly isn't recommended. With that information, then I think where I am at is:
So I think this would cross off option 2 above. |
ff63cc7
to
496ce19
Compare
@gadfly361 |
@M-sleeper Thank you! I added a note to your fork in the README |
This PR should solve the subscription warnings of re-frame, see related issue: #13
The cause of the warnings was, that re-frame's subscription system is not fully prepared for use-cases not in the reactive context. In this specific case re-pressed called the subscriptions in the event handler of keyboard events. One possible solution to avoid these warnings to access the app-db directly in an event, not via subscriptions in an effect handler. So, I changed the implementation of the effect handler such that it calls an event, that can access the app-db and dispatch the required further events.
One possible issue can be that instead of dispatch-synch I use the
:fx [[:dispatch [...]]]
return value of the event. This means that instead of directly processing the keyboard event it will put the events in reframe's event queue. This should not cause issues in most cases.I tested the main functionalities locally but eventually there can be bugs in the change. Any review/feedback is welcome.