-
-
Notifications
You must be signed in to change notification settings - Fork 716
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
Add dynamic subscriptions to re-frame #108
Conversation
9193124
to
e01023a
Compare
I talked with @mike-thompson-day8 about this and he discovered a way to avoid calling |
Warn the programmer if any item in We've had a case of someone accidentally passing in a string by mistake and it took them a while to find the reported problem (an exception about something getting derefed which shouldn't be) |
I've added an error message when passing non-reactive parameters. I'm open to better wording for the error though. |
@danielcompton my version of that error message and surrounds would be:
|
53fc75c
to
c1c9078
Compare
I've used your code, and modified the error message slightly to give the technical details.
While I think this is a pretty good solution and technically sound, I think we should mark this as experimental at first if we accept the PR. |
c1c9078
to
610bc3e
Compare
610bc3e
to
3e8f1e1
Compare
For anyone watching this issue, it's out in https://github.com/Day8/re-frame/releases/tag/v0.5.0-alpha1. Try it out in your apps and give us feedback. |
Released in version 0.5.0 |
Dynamic subscriptions allow the user to create subscriptions that depend on Ratoms/Reactions and will be rerun when they change. Users will subscribe with v and a vector of dynamic values. The dynamic values are dereffed and passed to the handler-fn. Dynamic subscriptions need to pass a fn which takes app-db, v, and the dereffed dynamic values.
Every time a dynamic value changes, handler-fn will be rerun. This is in contrast to standard subscriptions where handler-fn will only be run once, although the reaction that it produces will change over time.
A concrete example of the need for this is:
a Reaction which changes in response to server changes.
of the query parameters.
In the current system, all views need to be aware of the possibility of changing parameters and provide them in their subscriptions.
Example usage code:
Tasks: