Skip to content

Commit

Permalink
Rename SSRManifest to ServerConsumerManifest
Browse files Browse the repository at this point in the history
This option was renamed.
  • Loading branch information
sebmarkbage committed Oct 20, 2024
1 parent 7b454fe commit e249bd7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3403,9 +3403,10 @@ export async function warmFlightResponse(

try {
createFromReadableStream(flightStream, {
ssrManifest: {
serverConsumerManifest: {
moduleLoading: clientReferenceManifest.moduleLoading,
moduleMap: clientReferenceManifest.ssrModuleMapping,
serverModuleMap: null,
},
})
} catch {
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/server/app-render/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,15 @@ export async function decryptActionBoundArgs(
},
}),
{
ssrManifest: {
serverConsumerManifest: {
// moduleLoading must be null because we don't want to trigger preloads of ClientReferences
// to be added to the current execution. Instead, we'll wait for any ClientReference
// to be emitted which themselves will handle the preloading.
moduleLoading: null,
moduleMap: isEdgeRuntime
? clientReferenceManifestSingleton.edgeRscModuleMapping
: clientReferenceManifestSingleton.rscModuleMapping,
serverModuleMap: null, // getServerModuleMap()
},
}
)
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/server/app-render/use-flight-response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ export function useFlightStream<T>(
}

const newResponse = createFromReadableStream(flightStream, {
ssrManifest: {
serverConsumerManifest: {
moduleLoading: clientReferenceManifest.moduleLoading,
moduleMap: isEdgeRuntime
? clientReferenceManifest.edgeSSRModuleMapping
: clientReferenceManifest.ssrModuleMapping,
serverModuleMap: null,
},
nonce,
})
Expand Down
5 changes: 3 additions & 2 deletions packages/next/src/server/use-cache/use-cache-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,18 +671,19 @@ export function cache(kind: string, id: string, fn: any) {
// the server, which is required to pick it up for replaying again on the client.
const replayConsoleLogs = true

const ssrManifest = {
const serverConsumerManifest = {
// moduleLoading must be null because we don't want to trigger preloads of ClientReferences
// to be added to the consumer. Instead, we'll wait for any ClientReference to be emitted
// which themselves will handle the preloading.
moduleLoading: null,
moduleMap: isEdgeRuntime
? clientReferenceManifest.edgeRscModuleMapping
: clientReferenceManifest.rscModuleMapping,
serverModuleMap: null,
}

return createFromReadableStream(stream, {
ssrManifest,
serverConsumerManifest,
temporaryReferences,
replayConsoleLogs,
environmentName: 'Cache',
Expand Down
13 changes: 9 additions & 4 deletions packages/next/types/$$compiled.internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ declare module 'react-server-dom-webpack/static.edge' {
}
declare module 'react-server-dom-webpack/client.edge' {
export interface Options {
ssrManifest: SSRManifest
serverConsumerManifest: ServerConsumerManifest
nonce?: string
encodeFormAction?: EncodeFormActionCallback
temporaryReferences?: TemporaryReferenceSet
Expand Down Expand Up @@ -265,12 +265,17 @@ declare module 'react-server-dom-webpack/client.edge' {
async?: boolean
}

export interface SSRManifest {
moduleMap: SSRModuleMap
export type ServerManifest = {
[id: string]: ImportManifestEntry
}

export interface ServerConsumerManifest {
moduleMap: ServerConsumerModuleMap
moduleLoading: ModuleLoading | null
serverModuleMap: null | ServerManifest
}

export interface SSRModuleMap {
export interface ServerConsumerModuleMap {
[clientId: string]: {
[clientExportName: string]: ImportManifestEntry
}
Expand Down

0 comments on commit e249bd7

Please sign in to comment.