Skip to content
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

Test two ways to get regular atoms work in reactive context #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Deraen
Copy link
Member

@Deraen Deraen commented Sep 3, 2021

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 use IWatchable -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.

@pepijndevos
Copy link

Maybe the watch function should pass the wrapper reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants