Skip to content

Commit 703133f

Browse files
Remove unnecessary console logs from worker and test files
1 parent 0fadbe6 commit 703133f

File tree

3 files changed

+1
-22
lines changed

3 files changed

+1
-22
lines changed

react_on_rails_pro/packages/node-renderer/src/worker.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ const setResponse = async (result: ResponseResult, res: FastifyReply) => {
8181
setHeaders(headers, res);
8282
res.status(status);
8383
if (stream) {
84-
console.log('Sending stream');
8584
await res.send(stream);
86-
console.log('Stream sent');
8785
} else {
8886
res.send(data);
8987
}
@@ -396,15 +394,13 @@ export default function run(config: Partial<Config>) {
396394
return undefined;
397395
},
398396
});
399-
console.log('handleIncrementalRenderStream done 1');
400397
} catch (err) {
401398
// If an error occurred during stream processing, send error response
402399
const errorResponse = errorResponseResult(
403400
formatExceptionMessage('IncrementalRender', err, 'Error while processing incremental render stream'),
404401
);
405402
await setResponse(errorResponse, res);
406403
}
407-
console.log('handleIncrementalRenderStream done 2');
408404
});
409405

410406
// There can be additional files that might be required at the runtime.

react_on_rails_pro/packages/node-renderer/src/worker/handleIncrementalRenderStream.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export async function handleIncrementalRenderStream(
7575
const result = await onRenderRequestReceived(parsed);
7676
const { response, shouldContinue: continueFlag } = result;
7777

78-
// eslint-disable-next-line no-await-in-loop
7978
void onResponseStart(response);
8079

8180
if (!continueFlag) {
@@ -90,7 +89,6 @@ export async function handleIncrementalRenderStream(
9089
} else {
9190
try {
9291
// eslint-disable-next-line no-await-in-loop
93-
console.log('onUpdateReceived', parsed);
9492
await onUpdateReceived(parsed);
9593
} catch (err) {
9694
// Error in update chunk processing - log and report but continue processing
@@ -103,7 +101,6 @@ export async function handleIncrementalRenderStream(
103101
}
104102
}
105103
}
106-
console.log('handleIncrementalRenderStream done');
107104
} catch (err) {
108105
const error = err instanceof Error ? err : new Error(String(err));
109106
// Update the error message in place to retain the original stack trace, rather than creating a new error object
@@ -112,7 +109,5 @@ export async function handleIncrementalRenderStream(
112109
}
113110

114111
// Stream ended normally
115-
console.log('onRequestEnded');
116112
void onRequestEnded();
117-
console.log('onRequestEnded done');
118113
}

react_on_rails_pro/packages/node-renderer/tests/incrementalRender.test.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ describe('incremental render NDJSON endpoint', () => {
160160

161161
const sink: incremental.IncrementalRenderSink = {
162162
add: (chunk) => {
163-
console.log('Sink.add called with chunk:', chunk);
164163
processedChunks.push(chunk);
165164
sinkAdd(chunk);
166165
},
@@ -224,11 +223,9 @@ describe('incremental render NDJSON endpoint', () => {
224223
req.on('response', (res) => {
225224
res.on('data', (chunk: Buffer) => {
226225
const chunkStr = chunk.toString();
227-
console.log('Client received chunk:', chunkStr);
228226
streamedChunks.push(chunkStr);
229227
});
230228
res.on('end', () => {
231-
console.log('Client response ended, total chunks received:', streamedChunks.length);
232229
resolve({
233230
statusCode: res.statusCode || 0,
234231
streamedData: streamedChunks,
@@ -250,13 +247,11 @@ describe('incremental render NDJSON endpoint', () => {
250247
});
251248

252249
afterAll(async () => {
253-
console.log('afterAll');
254250
await app.close();
255-
console.log('afterAll done');
256251
});
257252

258253
test('calls handleIncrementalRenderRequest immediately after first chunk and processes each subsequent chunk immediately', async () => {
259-
const { sink, sinkAddCalls, sinkEnd, sinkAbort, handleSpy, SERVER_BUNDLE_TIMESTAMP } =
254+
const { sinkAddCalls, sinkEnd, sinkAbort, handleSpy, SERVER_BUNDLE_TIMESTAMP } =
260255
await createBasicTestSetup();
261256

262257
// Create the HTTP request
@@ -434,7 +429,6 @@ describe('incremental render NDJSON endpoint', () => {
434429
expect(sinkEnd).toHaveBeenCalledTimes(1);
435430
expect(sinkAbort).not.toHaveBeenCalled();
436431
});
437-
console.log('sinkAddCalls');
438432
});
439433

440434
test('handles empty lines gracefully in the stream', async () => {
@@ -559,7 +553,6 @@ describe('incremental render NDJSON endpoint', () => {
559553

560554
// Write first object (valid JSON)
561555
const initialObj = createInitialObject(SERVER_BUNDLE_TIMESTAMP);
562-
console.log('Sending initial chunk:', initialObj);
563556
req.write(`${JSON.stringify(initialObj)}\n`);
564557

565558
// Wait for the server to process the first object and set up the response
@@ -584,13 +577,10 @@ describe('incremental render NDJSON endpoint', () => {
584577
});
585578

586579
// End the request
587-
console.log('Ending request');
588580
req.end();
589581

590582
// Wait for the request to complete and capture the streaming response
591-
console.log('Waiting for response');
592583
const response = await responsePromise;
593-
console.log('Response:', response);
594584

595585
// Verify the response status
596586
expect(response.statusCode).toBe(200);
@@ -607,10 +597,8 @@ describe('incremental render NDJSON endpoint', () => {
607597
// Verify that all request chunks were processed
608598
expect(processedChunks).toEqual(chunksToSend);
609599

610-
console.log('handleSpy');
611600
// Verify that the mock was called correctly
612601
expect(handleSpy).toHaveBeenCalledTimes(1);
613-
console.log('handleSpy done');
614602

615603
await waitFor(() => {
616604
expect(sink.end).toHaveBeenCalled();

0 commit comments

Comments
 (0)