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

Mutation query responses may be cached #115

Open
jerrysu opened this issue Mar 17, 2021 · 1 comment
Open

Mutation query responses may be cached #115

jerrysu opened this issue Mar 17, 2021 · 1 comment

Comments

@jerrysu
Copy link
Contributor

jerrysu commented Mar 17, 2021

Both useMutation and useBulkMutation may end up using cached query responses if the action doesn't change between mutations (e.g., the POST data remains the same). It seems wrong to me that mutations would be cached.

The query function has a skipCache flag that needs to be set on these two lines:

const queryResponse = await clientContext.query<T>({ ...action, signal: action.signal || signal });

const queryResponses: Array<QueryResponse<T>> = await Promise.all(actions.map(action => query<T>(action)));

I'll submit a PR for this after I free up some time.

@jerrysu
Copy link
Contributor Author

jerrysu commented Mar 17, 2021

Actually, now that I think about it, this is an issue for us because we want to cache some POST requests that we use with useSuspenseQuery. This is actually more of an issue with the design of our API.

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