File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
packages/react-on-rails-pro-node-renderer/src Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -315,15 +315,15 @@ export default function run(config: Partial<Config>) {
315315 }
316316 } ,
317317
318- onUpdateReceived : ( obj : unknown ) => {
318+ onUpdateReceived : async ( obj : unknown ) => {
319319 if ( ! incrementalSink ) {
320320 log . error ( { msg : 'Unexpected update chunk received after rendering was aborted' , obj } ) ;
321321 return ;
322322 }
323323
324324 try {
325325 log . info ( `Received a new update chunk ${ JSON . stringify ( obj ) } ` ) ;
326- incrementalSink . add ( obj ) ;
326+ await incrementalSink . add ( obj ) ;
327327 } catch ( err ) {
328328 // Log error but don't stop processing
329329 log . error ( { err, msg : 'Error processing update chunk' } ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { getRequestBundleFilePath } from '../shared/utils';
55
66export type IncrementalRenderSink = {
77 /** Called for every subsequent NDJSON object after the first one */
8- add : ( chunk : unknown ) => void ;
8+ add : ( chunk : unknown ) => Promise < void > ;
99 handleRequestClosed : ( ) => void ;
1010} ;
1111
@@ -93,11 +93,11 @@ export async function handleIncrementalRenderRequest(
9393 return {
9494 response,
9595 sink : {
96- add : ( chunk : unknown ) => {
96+ add : async ( chunk : unknown ) => {
9797 try {
9898 assertIsUpdateChunk ( chunk ) ;
9999 const bundlePath = getRequestBundleFilePath ( chunk . bundleTimestamp ) ;
100- executionContext . runInVM ( chunk . updateChunk , bundlePath ) . catch ( ( err : unknown ) => {
100+ await executionContext . runInVM ( chunk . updateChunk , bundlePath ) . catch ( ( err : unknown ) => {
101101 log . error ( { msg : 'Error running incremental render chunk' , err, chunk } ) ;
102102 } ) ;
103103 } catch ( err ) {
Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ export async function buildExecutionContext(
365365 const objectResult = await result ;
366366 result = JSON . stringify ( objectResult ) ;
367367 }
368- if ( log . level === 'debug' ) {
368+ if ( log . level === 'debug' && result ) {
369369 log . debug ( `result from JS:
370370 ${ smartTrim ( result ) } ` ) ;
371371 const debugOutputPathResult = path . join ( serverBundleCachePath , 'result.json' ) ;
You can’t perform that action at this time.
0 commit comments