Refetch queries server side after a client side mutation apollo client

Refetch queries server side after a client side mutation apollo client


0

I’m using the experimental version of graphql and apollo client together with next13 and at one point in my code I perform a mutation in a client side component to delete data and I need the query that was performed in a server side component to be re-done for the list of results to be updated. How can I do this?

i am using the following code to do the queries and mutations in the server side components:

const {data: userEvents} = await getClient().query()

and the following code in client components:

const [deleteEvent] = useMutation(DeleteEvent, { refetchQueries: [ { query: getAllUserEvents, variables: { userId: session?.user.id } } ] })

I need that when I perform the deletion mutation on the client side component the search query on the server side component is re-done.

Share
Improve this question


Load 5 more related questions


Show fewer related questions

0

Reset to default



Browse other questions tagged

or ask your own question.

Leave a Reply

Your email address will not be published. Required fields are marked *