Unverified Commit 623e88e5 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

[Deprecation Warnings]: add unstable_rootParams deprecation warning (#82582)

`unstable_rootParams()` is deprecated in favor of importing specific
params from `next/root-params`. This also requires enabling the
experimental feature in nextConfig via `experimental.rootParams`.
parent 7a318128
......@@ -21,11 +21,18 @@ import {
wellKnownProperties,
} from '../../shared/lib/utils/reflect-utils'
import { actionAsyncStorage } from '../app-render/action-async-storage.external'
import { warnOnce } from '../../build/output/log'
interface CacheLifetime {}
const CachedParams = new WeakMap<CacheLifetime, Promise<Params>>()
/**
* @deprecated import specific root params from `next/root-params` instead.
*/
export async function unstable_rootParams(): Promise<Params> {
warnOnce(
'`unstable_rootParams()` is deprecated and will be removed in an upcoming major release. Import specific root params from `next/root-params` instead.'
)
const workStore = workAsyncStorage.getStore()
if (!workStore) {
throw new InvariantError('Missing workStore in unstable_rootParams')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment