liveBook · Manning

Unstable_noStore

As explained in Build AI-Enhanced Web Apps

A Next.js cache-control function that opts a component out of caching so it fetches fresh data.

unstable_noStore opts a component out of caching at the component level. Use it when cached responses interfere with Next.js streaming and the component must fetch fresh data. section 8.1.1

Disable caching before streaming data

Import the function from next/cache, call it inside the async component, and then perform the streaming operation:\n\nimport { unstable_noStore as noStore } from 'next/cache';\n\nexport default async function Component() {\n noStore();\n const result = await streamText({...});\n ...\n}\n\nThis is especially useful when deployment caching prevents streaming from functioning correctly. section 8.1.1

import { unstable_noStore as noStore } from 'next/cache'; 

export default async function Component() { 
  noStore();
  const result = await streamText({...});
  ...
}

Shows the complete import, component-level call, and streaming call in one implementation example. section 8.1.1

How Build AI-Enhanced Web Apps covers it

How deep it goes
Explains component-level behavior and provides an import-and-call example, but defers provider-specific nuances to documentation.
Examples
Uses an async component that calls noStore before invoking streamText.
What you can do after
Apply it via next/cache to force fresh component data when caching disrupts streaming behavior.
How it connects
Connects caching, streaming responses, the Next.js App Router, deployment providers, and dynamic rendering.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI-Enhanced Web Apps. The section links point to the parts of the book it draws on.