Skip to content

Commit 407d885

Browse files
authored
Revert "fix: clear timeout when turbo-stream encoding completes (remix-run#14735)" (remix-run#14809)
This reverts commit 44991a9.
1 parent d5ef31d commit 407d885

4 files changed

Lines changed: 2 additions & 14 deletions

File tree

.changeset/clear-stream-timeout.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

contributors.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@
277277
- maximevtush
278278
- maxpou
279279
- mcansh
280-
- mcollina
281280
- MeatSim
282281
- MenouerBetty
283282
- Methuselah96

packages/react-router/lib/server-runtime/single-fetch.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,10 @@ export function encodeViaTurboStream(
385385
() => controller.abort(new Error("Server Timeout")),
386386
typeof streamTimeout === "number" ? streamTimeout : 4950,
387387
);
388-
389-
let clearStreamTimeout = () => clearTimeout(timeoutId);
390-
391-
requestSignal.addEventListener("abort", clearStreamTimeout);
388+
requestSignal.addEventListener("abort", () => clearTimeout(timeoutId));
392389

393390
return encode(data, {
394391
signal: controller.signal,
395-
onComplete: clearStreamTimeout,
396392
plugins: [
397393
(value) => {
398394
// Even though we sanitized errors on context.errors prior to responding,

packages/react-router/vendor/turbo-stream-v2/turbo-stream.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,9 @@ export function encode(
138138
plugins?: EncodePlugin[];
139139
postPlugins?: EncodePlugin[];
140140
signal?: AbortSignal;
141-
onComplete?: () => void;
142141
},
143142
) {
144-
const { plugins, postPlugins, signal, onComplete } = options ?? {};
143+
const { plugins, postPlugins, signal } = options ?? {};
145144

146145
const encoder: ThisEncode = {
147146
deferred: {},
@@ -275,7 +274,6 @@ export function encode(
275274
}
276275
await Promise.all(Object.values(encoder.deferred));
277276

278-
onComplete?.();
279277
controller.close();
280278
},
281279
});

0 commit comments

Comments
 (0)