apollographql / apollographql/apollo-client-integrations
How to get the latest data
- Dominant language
- TypeScript
- Stars
- 556
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
```
import { HttpLink } from '@apollo/client';
import { registerApolloClient } from '@apollo/experimental-nextjs-app-support/rsc';
import {
NextSSRApolloClient,
NextSSRInMemoryCache,
} from '@apollo/experimental-nextjs-app-support/ssr';
import { APOLLO_CLIENT_URL } from './apolloClient';
export const { getClient } = registerApolloClient(() => {
return new NextSSRApolloClient({
cache: new NextSSRInMemoryCache(),
link: new HttpLink({
uri: APOLLO_CLIENT_URL,
fetchOptions: { cache: 'no-store' },
}),
});
});
```
```
export default async function Index() {
const { data } = await getClient().query({
query: queryImages,
variables: { limit: LIMIT_IMAGES_COUNT, offset: 0 },
context: {
fetchOptions: {
next: { revalidate: 10 },
},
},
fetchPolicy: 'no-cache',
});
return (
);
}
```
The backend data is updated frequently, but the data I get every time is only the data from the last build. I've tried without caching without success.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the registerApolloClient/getClient setup and the Index query shown in the issue, focusing on the interaction between fetchOptions, revalidate, fetchPolicy, and the Next.js App Router. Reproduce the stale-data behavior and determine which cache layer is serving the build-time result; done means runtime requests return updated backend data or the required configuration is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100