Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Apollo): Set initialFetchPolicy to 'cache-first' and implement a basic nextFetchPolicy #870

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

qgerome
Copy link
Member

@qgerome qgerome commented Nov 18, 2024

The nextFetchPolicy is taken from the Apollo documentation

Context

We saw that when navigating between pages using links the Apollo cache was not used to render the data even though it was pre-populated by the SSR of the app. This was caused by the cache-and-network setting that always fires a request to the server to ensure to have the freshest data possible. It's not relevant for the initial load since we can be certain it is fresh.

cache-and-network

Apollo Client executes the full query against both the cache and your GraphQL server. The query automatically updates if the result of the server-side query modifies cached fields.Provides a fast response while also helping to keep cached data consistent with server data.

…basic nextFetchPolicy

The nextFetchPolicy is taken from the Apollo documentation
Copy link
Contributor

@cheikhgwane cheikhgwane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works well !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants