Next.js Discord

Discord Forum

help with ISR

Answered
mihir posted this in #help-forum
Open in Discord
how do i update my page when i post something on graph ql
i already did
export const revalidate = 0 // revalidate this page every 60 seconds
export const dynamic = 'force-dynamic'
export const fetchCache = 'force-no-store'

but it isnt working
Answered by mihir
import { ApolloClient, InMemoryCache } from '@apollo/client';

const defaultOptions = {
    watchQuery: {
      fetchPolicy: 'no-cache',
      errorPolicy: 'ignore',
    },
    query: {
      fetchPolicy: 'no-cache',
      errorPolicy: 'all',
    },
  }

const client = new ApolloClient({
    uri: process.env.GRAPHCMPURI,
    cache: new InMemoryCache(),
    defaultOptions: defaultOptions,
});

export default client;
View full answer

15 Replies

When you post something and you are sure the data is updated, you can call router.refresh to refresh the data from your server components
mostly cause of how vercel works
never mind the issue is back
it just does not update
it just updated...
after 10 mins
why is this happening
someone explain to me
This is regarding data that is asynchronously provided to a server component?
fixed my issue finally
this was cause of
import { ApolloClient, InMemoryCache } from '@apollo/client';

const defaultOptions = {
    watchQuery: {
      fetchPolicy: 'no-cache',
      errorPolicy: 'ignore',
    },
    query: {
      fetchPolicy: 'no-cache',
      errorPolicy: 'all',
    },
  }

const client = new ApolloClient({
    uri: process.env.GRAPHCMPURI,
    cache: new InMemoryCache(),
    defaultOptions: defaultOptions,
});

export default client;
Answer
i was not using that default options thing
now its instant
Its so dumb how its so easy to find out the answer but finding out what's wrong is the worst part