Relative Content

Tag Archive for reactjsserver-side-renderingapollo-clientnextjs14

Refreshing data client side after mutations when data initially loaded using apollo in SSR component in Next 14

So until now my general pattern with Apollo has been to fetch and cache data on the client. Then when I fire off am mutation I do an optimistic update to the cache, my UI immediately gets the optimistic update and the cache then updates once the mutation returns. So, say I have a component that displays a count of comments and then in a separate component I add a new comment, as part of the optimistic update I will write to the client cache to update the count so that my count component updates ahead of the mutation completing.