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

chore(rsc): Fix executeRsa comments #11453

Merged
merged 1 commit into from
Sep 6, 2024
Merged
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
12 changes: 6 additions & 6 deletions packages/vite/src/rsc/rscRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ export async function renderRsc(input: RenderInput): Promise<ReadableStream> {
console.log('renderRsc input', input)

const serverRoutes = await getRoutesComponent()
// TODO (RSC): Should this have the same shape as for handleRsa?
// TODO (RSC): Should this have the same shape as for executeRsa?
const model = createElement(serverRoutes, input.props)

console.log('rscRenderer.ts renderRsc renderRsc props', input.props)
console.log('rscRenderer.ts renderRsc props', input.props)
console.log('rscRenderer.ts renderRsc model', model)

return renderToReadableStream(model, getBundlerConfig())
// TODO (RSC): We used to transform() the stream here to remove
// "prefixToRemove", which was the common base path to all filenames. We
// then added it back in handleRsa with a simple
// then added it back in handleRsc with a simple
// `path.join(config.root, fileId)`. I removed all of that for now to
// simplify the code. But if we wanted to add it back in the future to save
// some bytes in all the Flight data we could.
Expand All @@ -150,7 +150,7 @@ function isSerializedFormData(data?: unknown): data is SerializedFormData {
}

export async function executeRsa(input: RenderInput): Promise<ReadableStream> {
console.log('handleRsa input', input)
console.log('executeRsa input', input)

if (!input.rsaId || !input.args) {
throw new Error('Unexpected input')
Expand Down Expand Up @@ -184,14 +184,14 @@ export async function executeRsa(input: RenderInput): Promise<ReadableStream> {
console.log('rscRenderer.ts rsa return data', data)

const serverRoutes = await getRoutesComponent()
console.log('rscRenderer.ts handleRsa serverRoutes', serverRoutes)
console.log('rscRenderer.ts executeRsa serverRoutes', serverRoutes)
const model = {
Routes: createElement(serverRoutes, {
location: { pathname: '/', search: '' },
}),
__rwjs__rsa_data: data,
}
console.log('rscRenderer.ts handleRsa model', model)
console.log('rscRenderer.ts executeRsa model', model)

return renderToReadableStream(model, getBundlerConfig())
}
Loading