Skip to content

fix(query): Update notifyManager scheduler to use queueMicrotask#111187

Merged
TkDodo merged 6 commits intomasterfrom
tkdodo/ref/react-query-scheduler
Mar 24, 2026
Merged

fix(query): Update notifyManager scheduler to use queueMicrotask#111187
TkDodo merged 6 commits intomasterfrom
tkdodo/ref/react-query-scheduler

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Mar 20, 2026

see the code comment for motivation

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 20, 2026
@TkDodo TkDodo merged commit 0c29dd2 into master Mar 24, 2026
71 checks passed
@TkDodo TkDodo deleted the tkdodo/ref/react-query-scheduler branch March 24, 2026 10:37
TkDodo added a commit that referenced this pull request Mar 24, 2026
…on page (#111204)

for forms where we stay on the same page (no modals that close, no
redirects), we should reset the form after the source of `defaultValues`
(usually a query or a store) has been updated.

while the defaultValues are reactive by themselves, they only get
applied if the form is `pristine`. That means the `value` won’t change.
Now that might not be a problem if the server returns the same values,
but if it doesn’t, we’d want to see the server values here.

I’ve simulated this in the story where the mutation returns the input as
`toUpperCase()`, so that we can see what’s happening.

This also means if you only make a mutation and forget to update the
query, or if you don’t return the invalidation from the mutation, the
values will “flicker” back to the old initial state. This is intended
because it serves as a reminder that the corresponding query / store
needs to be updated.

For AutoSaveForms, we’re doing this internally.

Note: The reset is timing sensitive. If it happens too early, there will
be a flash of old initialData briefly. That’s why this PR is dependent
upon:

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants