Skip to content

Conversation

@michael-small
Copy link
Collaborator

@michael-small michael-small commented Jan 22, 2026

Wondered how, imagined this was how, and saw that the JSDoc mentions this. But no doc mention until now.

Closes #281

@michael-small michael-small self-assigned this Jan 22, 2026
@michael-small michael-small added the documentation Improvements or additions to documentation label Jan 22, 2026
@michael-small michael-small linked an issue Jan 22, 2026 that may be closed by this pull request
);

// Unnamed resource: `value`
patchState(store, { value: undefined });
Copy link
Collaborator

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' }]})

Copy link
Collaborator

@rainerhahnekamp rainerhahnekamp left a 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?

@rainerhahnekamp rainerhahnekamp merged commit 25ee515 into main Jan 25, 2026
1 check passed
@rainerhahnekamp
Copy link
Collaborator

Thanks @michael-small

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(withResource): mention how to patch state

2 participants