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

useUpsertMutation causes unnecessary refetches #526

Open
colespencer1453 opened this issue Nov 10, 2024 · 1 comment
Open

useUpsertMutation causes unnecessary refetches #526

colespencer1453 opened this issue Nov 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@colespencer1453
Copy link

Describe the bug
When calling mutateAsync from the useUpsertMutation hook the data is refetched once per the number of rows updated in the upsert.

To Reproduce
To reproduce put a useQuery hook and useUpsertMutation hook in the same file for the same table. They should both fetch and update an array of rows.

Expected behavior
The refetch should only happen once for the upsert mutation

Additional context
I was trying to figure out why this would be. I confirmed that when I just update a single row there is only one api request. Is there anywhere in the repo you could point me that is responsible for this behavior?

@colespencer1453 colespencer1453 added the bug Something isn't working label Nov 10, 2024
@psteinroe
Copy link
Owner

I think this is related to how react query works. In SWR, we set revalidateIfStale to false (docs) and explicit set revalidate to false when doing the mutation

I dont know if there is such a setting for react query since I am not very experienced with it. maybe you can take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants