Caching for server components
Unanswered
American Chinchilla posted this in #help-forum
American ChinchillaOP
Hello, I'm still trying to figure out caching and server component
I have a dynamic (server-rendered on demand) page that runs a fetch to an external API
When I move to the following page (using the next button of the browser), and then do some change externally (using postman), and then come back to the original page (by clicking browser back button) the old information is still displayed.
Only after refreshing I get the latest version of the data
I thought that
1- fetch are by defailt no-store
2- exporting dynamc = "force-dynamic" would make it fully dynamic...every time you visit the page the fetch is requested.
Is this correct?
Does this has to do with the back/next button of the browser?
My page is pretty basic
I have a dynamic (server-rendered on demand) page that runs a fetch to an external API
├ ƒ /application/[applicationId]/life-assured-information
When I move to the following page (using the next button of the browser), and then do some change externally (using postman), and then come back to the original page (by clicking browser back button) the old information is still displayed.
Only after refreshing I get the latest version of the data
I thought that
1- fetch are by defailt no-store
2- exporting dynamc = "force-dynamic" would make it fully dynamic...every time you visit the page the fetch is requested.
Is this correct?
Does this has to do with the back/next button of the browser?
My page is pretty basic
const LifeAssuredInformationPage = async ({
params,
}: {
params: Promise<ApplicationIdParam>;
}) => {
const { applicationId } = await params;
const application = await fetchApplication(applicationId);
const livesMetadata = await fetchLivesMetadata();
return (
<PageContainer header={<PageTitle title="Life Assured Information" />}>
<BasicDetailsForm
lives={application?.lives || []}
livesMetadata={
livesMetadata ?? {
lifeAgeRangeMin: 18,
lifeAgeRangeMax: 75,
lifeQuestionData: [],
}
}
/>
</PageContainer>
);
};