Test two ways to get regular atoms work in reactive context #547
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #546
react
name is already so overloaded that I think we want to avoid that.Looks like just calling
notify-deref-watcher!
is enough. That function doesn't modify the atom itself, but stores reference to current reactive context to the atom. Reagent will then useIWatchable
-add-watch
(and-remove-watch
) to make reactive context to listen to this atom. Because regular atom implements this protocol same as Ratom.While it would be simple to just provide single function to use instead of regular
deref
to use with normal atoms, I think better API might be to provide function to wrap atoms, so we can replace deref implementation. This way we could later also modify other methods, if necessary for some reason.