help with ISR
Answered
mihir posted this in #help-forum
mihirOP
how do i update my page when i post something on graph ql
i already did
but it isnt working
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;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
mihirOP
mostly cause of how vercel works
mihirOP
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?
mihirOP
fixed my issue finally
this was cause of
mihirOP
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
mihirOP
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