11import * as React from 'react' ;
2- import type { WebpackMap } from 'react-server-dom-webpack' ;
2+ import type { ClientManifest } from 'react-server-dom-webpack' ;
33import ReactServerDOMServer from 'react-server-dom-webpack/server' ;
44import { App } from '../../components/server/app.js' ;
55import { PathnameServerContextName } from '../../pathname-server-context.js' ;
@@ -31,7 +31,7 @@ const handleGet: ExportedHandlerFetchHandler<EnvWithStaticContent> = async (
3131 />
3232 < App />
3333 </ > ,
34- reactClientManifest as WebpackMap ,
34+ reactClientManifest as ClientManifest ,
3535 {
3636 context : [
3737 [ `WORKAROUND` , null ] , // TODO: First value has a bug where the value is not set on the second request: https://github.com/facebook/react/issues/24849
@@ -69,7 +69,8 @@ const handlePost: ExportedHandlerFetchHandler<EnvWithStaticContent> = async (
6969 return new Response ( null , { status : 500 } ) ;
7070 }
7171
72- const args = ( await request . json ( ) ) as unknown [ ] ;
72+ const body = await request . text ( ) ;
73+ const args = await ReactServerDOMServer . decodeReply ( body ) ;
7374 const actionPromise = action . apply ( null , args ) ;
7475
7576 const reactClientManifest = await getJsonFromKv (
@@ -79,11 +80,13 @@ const handlePost: ExportedHandlerFetchHandler<EnvWithStaticContent> = async (
7980
8081 const rscStream = ReactServerDOMServer . renderToReadableStream (
8182 actionPromise ,
82- reactClientManifest as WebpackMap ,
83+ reactClientManifest as ClientManifest ,
8384 {
8485 onError : ( error ) => {
8586 console . error ( error ) ;
8687
88+ // TODO: Sending the error message as digest kind of defeats the purpose
89+ // of having a digest to mask the error in production.
8790 return error instanceof Error ? error . message : `Unknown Error` ;
8891 } ,
8992 } ,
0 commit comments