Skip to content

improve mutation workflow #2261

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

Open
1 task
mplemay opened this issue Apr 23, 2025 · 0 comments
Open
1 task

improve mutation workflow #2261

mplemay opened this issue Apr 23, 2025 · 0 comments
Labels
enhancement New feature or request openapi-react-query Relevant to openapi-react-query

Comments

@mplemay
Copy link

mplemay commented Apr 23, 2025

Description

Currently, as far as I can tell when data gets mutated, you have to manually update the tanstack query data in order to update the client state.

const { data, error, refetch } = useQuery("get", "/api/test");
const { mutateAsync } = useMutate("patch", "/api/test");

const handleUpdateClick = async () => {
    await mutateAsync({ params: { query: { message: "Message updated by mutate!" } } });
    // optionally refresh, etc.
    refetch();
 };

There should be a clean way to update the query data without additional changes.

Proposal

Either add a parameter, etc. to automatically update the query data.

Extra

@mplemay mplemay added enhancement New feature or request openapi-react-query Relevant to openapi-react-query labels Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-react-query Relevant to openapi-react-query
Projects
None yet
Development

No branches or pull requests

1 participant