Uncached data access
A Server Component reads directly from a database or another data source that does not use fetch caching options.
Next.js 16+ · Function
unstable_noStore() opts a component out of prerendering and caching. It is deprecated in favor of connection() and should mainly be retained for existing code.
Call unstable_noStore() inside a Server Component before request-specific or uncached work. It opts that component out of prerendering and caching, providing a granular alternative to route-wide dynamic configuration; in current Next.js, connection() is the recommended replacement when request-time rendering is required.
unstable_noStore(): voidvoid
import { unstable_noStore as noStore } from 'next/cache'
export default async function Page() {
noStore()
const data = await db.query('SELECT * FROM products')
return <pre>{JSON.stringify(data, null, 2)}</pre>
}This Server Component opts its database-backed rendering out of prerendering and caching.
A Server Component reads directly from a database or another data source that does not use fetch caching options.
Only one component needs dynamic behavior while the rest of the route can remain statically optimized.
Existing code needs an explicit compatibility replacement for fetch no-store behavior.
unstable_noStore() declaratively opts a component out of prerendering and indicates that the component should not be cached. It is more granular than setting force-dynamic for the whole route and can be used where the uncached behavior is needed.
Follow-up: What should new code use instead? Use connection() when dynamic rendering is required, because the documentation recommends it as the replacement.
It is a replacement for fetch options such as cache: 'no-store' and next: { revalidate: 0 }, and it is useful when fetch is unavailable. The call is made directly in the component before the uncached work.
Follow-up: Does it override unstable_cache? No; inside unstable_cache, the cache configuration remains authoritative.
The function was introduced in version 14.0.0 and deprecated in version 15.0.0 in favor of connection(). Although still documented, it should generally be treated as a compatibility API rather than the preferred choice for new implementations.
Follow-up: Why might it still appear in existing applications? Existing code may use it for component-level opt-out behavior, but migration to connection() is the current direction.
connectionunstable_cachefetchexport const dynamic = 'force-dynamic'