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.
In Next, if I am doing the initial fetching of the comment count data on the server and passing it to my client count component. When I subsequently fire the mutation to add a comment, I have no client cache to update and so the only way for the count component to update would be to reload the page after the comment has been added?
Is there a standard pattern that should be used in this scenario? I’m wanting to leverage the performance enhancement SSR provides, but it feels that I will lose a lot of the asynchronous partial client reactiveness as a result.