Reputation: 542
I want to call refetch function after the mutation succeded:
const [joinTeam ] = useJoinTeamMutation();
const { refetch } = useGetTeam(slugName);
I tried doing:
joinTeam().then((res: any) => {
if (!res.error) {
refetch();
}
});
but this causes an error: Cannot refetch a query that has not been started yet.
Upvotes: 0
Views: 369
Reputation: 167
This is builtin using tags, no need for promises check the docs Automatic refetch
Upvotes: 1