-
Notifications
You must be signed in to change notification settings - Fork 44
docs(withResource): mention how to patch resource state
#282
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
Conversation
docs/docs/with-resource.md
Outdated
| ); | ||
|
|
||
| // Unnamed resource: `value` | ||
| patchState(store, { value: undefined }); |
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.
For both named and unnamed: Maybe we don't want to update a resource in a non-resolved status. So I wouldn't use undefined or `[];
What about something in the direction of
patchState(store, { value: { id: 1, name: 'John' } });
patchState(store, ({ listValue }) => { listValue: [...listValue, { id: 1, name: 'John' }]})
rainerhahnekamp
left a comment
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.
Will you apply the changes we discussed? Explaining the impact that undefined value vs. previous value has?
|
Thanks @michael-small |
Wondered how, imagined this was how, and saw that the JSDoc mentions this. But no doc mention until now.
Closes #281