-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
feat(utils): add subscribeKeys #887
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Thanks for the suggestion.
Another note is that we don't generally recommend using I'm not sure if I'm happy with returning the previous value. It can be a proxy object, and mutable. I think we should |
We are about to release v2 sometime soonish. |
Hey👋, I'm interested in contributing! |
Sent an invitation! |
Okay, I've accepted the invitation and joined Discord! |
Summary
New utility function based on the current
subscribeKey
that allows subscriptions to multiple properties of a proxy.This PR also adds an optional second argument to the callback function from
subscribeKey
, and therefore the newsubscribeKeys
to provide the previous value of the changed property.I felt this utility was needed when I had to subscribe to a proxy that changed multiple properties at once, and I needed those changes to execute a single callback.
Usage
Check List
yarn run prettier
for formatting code and docs