apollographql / apollographql/apollo-client-integrations

Cache handling error with cache-and-network policy in production

Open
#366 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
556
Forks
53
PR merge metrics
No merged PRs in 30d

Description

I am encountering a strange issue with Apollo Client when using the `cache-and-network` fetch policy.

When utilizing `useSuspenseQuery` with keywords filters to retrieve posts, the query sometimes returns an empty array. However, despite this empty array, the frontend continues to display posts that should not be present.

What's strange is that this behavior occurs only in production or when querying the production backend from my local frontend. In my local environment, everything functions as expected without this issue.

I'm looking for insights into why this cache handling error might be happening and how to address it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with the useSuspenseQuery call using the cache-and-network policy, and compare cache responses and requests against the local and production backends. Done means the production-only empty-array and stale-post behavior has a confirmed cause and fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.