Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type error from merge #70481

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions packages/next/src/server/use-cache/use-cache-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function generateCacheEntry(
fn: any
): Promise<ReadableStream> {
const temporaryReferences = createServerTemporaryReferenceSet()
const [, args] = await decodeReply(encodedArguments, serverManifest, {
const [, args] = await decodeReply<any[]>(encodedArguments, serverManifest, {
temporaryReferences,
})

Expand Down Expand Up @@ -117,19 +117,17 @@ async function generateCacheEntry(
const reader = savedStream.getReader()
const erroringSavedStream = new ReadableStream({
pull(controller) {
return reader
.read()
.then(({ done, value }: { done: boolean; value: any }) => {
if (done) {
if (didError) {
controller.error(firstError)
} else {
controller.close()
}
return
return reader.read().then(({ done, value }) => {
if (done) {
if (didError) {
controller.error(firstError)
} else {
controller.close()
}
controller.enqueue(value)
})
return
}
controller.enqueue(value)
})
},
cancel(reason: any) {
reader.cancel(reason)
Expand Down
4 changes: 4 additions & 0 deletions packages/next/types/$$compiled.internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ declare module 'react-server-dom-webpack/server.edge' {
}
},
options?: {
temporaryReferences?: string
environmentName?: string
filterStackFrame?: (url: string, functionName: string) => boolean
onError?: (error: unknown) => void
onPostpone?: (reason: string) => void
signal?: AbortSignal
}
): ReadableStream<Uint8Array>

export function createTemporaryReferenceSet(...args: any[]): any

type ServerManifest = {}

export function decodeReply<T>(
Expand Down
Loading