Hi there!
I’m trying to understand the problem a bit more.
You are writing
If the user changes to a different filter and again changes back to the original filter, all the previous fetched paginated data will be overwritten and the user will have to re-fetch the paginated data they already again.
Assuming you have correct keyArgs and don’t force a new network request, switching back to old filters should immediately serve the previous pagination from the cache instead of retrieving new data from the cache.
Do you have a specific networkPolicy here that forces a refetch? In that case a new incoming result might overwrite the existing cache entry.
Only if that is the case, you might need a merge policy (I assume that up until then you were merging everything in updateQuery) - but that merge policy would likely need to be a lot more intricate. It seems like you are using cursor pagination, but not relay-style cursor pagination.
Is there a specific reason for that schema design? We do offer helpers for relay-style cursor pagination.
All that said, could you share a bit more of your component/useQuery code? That part is still missing for a complete picture.