apollographql / apollographql/apollo-client-integrations

Re-fetching after error with useSuspenseQuery

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

Description

We currently use `useSuspenseQuery` to support prefetching data on the server in order to deliver a more performant client experience. For certain non-blocking queries we use `errorPolicy: all` in order to not throw an error for operations that shouldn't prevent the page from rendering.

However unlike `useQuery` whenever the same `useSuspenseQuery` is attempted to execute on the client again (after a non-thrown server failure) it won't try to refetch the query and looking at the data in the cache it shows `null`.

Is this potentially due to `useSuspenseQuery` filling the cache with a `null` value that prevents further queries due to using `cache-first`?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the client-side useSuspenseQuery behavior after a server failure with errorPolicy: all and cache-first. Inspect whether the cache retains null and prevents a retry; done means the query refetches on the client after the non-thrown failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.