I'm using the @apollo/client module to handle queries.
These queries are based on URL parameters, as so:
/users/:groupId/book/:viewId
both groupId and viewId are used as variables for my query:
const { groupId, viewId } = useParams<{ groupId: string; viewId: string }>();
const result = useViewSettingsQuery({
variables: { groupId, id: viewId },
skip: !viewId,
fetchPolicy: 'cache-and-network',
nextFetchPolicy: 'cache-first',
});
Now, the problem is, when switching from one view to another, Apollo Client will always display previous data for half a second, before displaying the actual data.
I took a look at the repository issues and thought it might be related to this one, but unfortunately, my server returns a proper unique ID for each query.
How comes that the previous data is always used first, even though the variables differ from one query to the next?