Skip to content
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

Asynchronous mutations are handled when finished. #3031

Open
mhverbakel opened this issue Oct 27, 2024 · 0 comments
Open

Asynchronous mutations are handled when finished. #3031

mhverbakel opened this issue Oct 27, 2024 · 0 comments

Comments

@mhverbakel
Copy link

Bug report

Description / Observed Behavior

When you provide an asynchronous function to the mutate function, the duration of the Promise does not seem to affect the other processes until it is resolved. isValidating is false for the duration of the Promise, and the automatic refresh intervals still get executed during the remote update.

Expected Behavior

When mutate is called with a data function that returns a Promise, the isValidating should go to true immediately, blocking any scheduled refreshing of the data.

Repro Steps / Code Example

https://codesandbox.io/p/sandbox/ts8qx3 (instructions included in example)

Additional Context

SWR Version 2.2.5

The test suite has tests for local mutations which includes tests for isValidating, but the remote mutation tests seem to lack this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant