-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve mutate function #245
Conversation
- If no data call trigger against the key - If data is a function call it passing current cached value - Return data or throw error after function
This is exactly what I'm looking for. Great work! In the mean time, for a bounded Mutate with ability to provide a function with access to the old data you can do this:
|
Also what I'm looking for :)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks amazing!
And I really like the boundMutate
idea. I think we can deprecate trigger
(and maybe revalidate
as well) in the future.
BTW, can you also add this new usage to the README?
Also as I commented in #262, I think we should remove the |
Also update related test to manually pass shouldRevalidate as false
@quietshu I updated the README and removed the |
Thank you @sergiodxa! |
* Annotate functions with argument names * Document bound mutate Refs #245 * Add code example to bound mutate section Co-authored-by: Jan Paulus <[email protected]>
key
already definedResolves #155
Resolves #253