Next.js Discord

Discord Forum

export const dynamic = 'force-dynamic'; turns fetch functions to no-store right?

Unanswered
NuclearMonkey posted this in #help-forum
Open in Discord
export const dynamic = 'force-dynamic'; turns fetch functions to no-store right?

6 Replies

export const dynamic = 'force-dynamic';

export default async function DynamicPage() {
  const response = await fetch(`https://api.quotable.io/quotes/random`);

  const data = await response.json();
  console.log(data.content);
  return (
    <div>
      <p>hello dynamic</p>
      <p>{data[0].content}</p>
    </div>
  );
}
this code is supposed to change data every time I refresh, but it stays the same on refresh. On older version of next js this doesn't happen.

My version of next is 14.2.3, I tried my code on 14.0.0 and it doesn't have the same behavior.
@ᴉuɐpɹɐɐ is this a next js bug?
@Arinji
Didn't we come to a conclusion abt this?