MCPcopy
hub / github.com/vercel/next.js / runCallbacks

Method runCallbacks

packages/next/src/server/after/after-context.ts:109–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107 }
108
109 private async runCallbacks(): Promise<void> {
110 if (this.callbackQueue.size === 0) return
111
112 for (const workUnitStore of this.workUnitStores) {
113 workUnitStore.phase = 'after'
114 }
115
116 const workStore = workAsyncStorage.getStore()
117 if (!workStore) {
118 throw new InvariantError('Missing workStore in AfterContext.runCallbacks')
119 }
120
121 return withExecuteRevalidates(workStore, () => {
122 this.callbackQueue.start()
123 return this.callbackQueue.onIdle()
124 })
125 }
126
127 private reportTaskError(taskKind: 'promise' | 'function', error: unknown) {
128 // TODO(after): this is fine for now, but will need better intergration with our error reporting.

Callers 1

runCallbacksOnCloseMethod · 0.95

Calls 4

withExecuteRevalidatesFunction · 0.90
startMethod · 0.65
getStoreMethod · 0.45
onIdleMethod · 0.45

Tested by

no test coverage detected