-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[unstable_after] compat: use waitUntil from NextRequestHint if no bui…
…ltin waitUntil is available
- Loading branch information
1 parent
e62bc11
commit 1d23c8a
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/next/src/client/components/lifecycle-async-storage-instance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createAsyncLocalStorage } from './async-local-storage' | ||
import type { LifecycleAsyncStorage } from './lifecycle-async-storage.external' | ||
|
||
export const lifecycleAsyncStorage: LifecycleAsyncStorage = | ||
createAsyncLocalStorage() |
11 changes: 11 additions & 0 deletions
11
packages/next/src/client/components/lifecycle-async-storage.external.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { AsyncLocalStorage } from 'async_hooks' | ||
// Share the instance module in the next-shared layer | ||
import { lifecycleAsyncStorage } from './lifecycle-async-storage-instance' with { 'turbopack-transition': 'next-shared' } | ||
|
||
export interface LifecycleStore { | ||
readonly waitUntil: ((promise: Promise<any>) => void) | undefined | ||
} | ||
|
||
export type LifecycleAsyncStorage = AsyncLocalStorage<LifecycleStore> | ||
|
||
export { lifecycleAsyncStorage } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters