Skip to content
Merged
Show file tree
Hide file tree
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
28 changes: 10 additions & 18 deletions patches/react-router@8.4.0.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/dist/development/lib/rsc/html-stream/server.js b/dist/development/lib/rsc/html-stream/server.js
index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2b2f755a3 100644
index 326e0ea1136babf7a9ed03bb59087140069758bf..ccfef142cb56f08bd58caf0eeb40790d61e1f7a6 100644
--- a/dist/development/lib/rsc/html-stream/server.js
+++ b/dist/development/lib/rsc/html-stream/server.js
@@ -21,11 +21,31 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
Expand All @@ -13,9 +13,9 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
+ timeout = null;
+ }
+ buffered.length = 0;
+ resolveFlightDataPromise();
+ if (rscReader && rscStream.locked) await rscReader.cancel(reason).catch(() => {});
+ else await rscStream.cancel(reason).catch(() => {});
+ resolveFlightDataPromise();
+ }
+ function tryEnqueue(controller, chunk) {
+ try {
Expand All @@ -35,7 +35,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
}
buffered.length = 0;
timeout = null;
@@ -37,31 +57,32 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
@@ -37,31 +57,28 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
timeout = setTimeout(async () => {
if (cancelled) return;
flushBufferedChunks(controller);
Expand All @@ -45,12 +45,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
rscReader = rscStream.getReader();
- writeRSCStream(rscReader, controller, () => cancelled, nonce).catch((err) => controller.error(err)).then(resolveFlightDataPromise);
+ writeRSCStream(rscReader, controller, () => cancelled, nonce).catch((err) => {
+ if (cancelled) return;
+ try {
+ controller.error(err);
+ } catch (error) {
+ return stop(error);
+ }
+ if (!cancelled) controller.error(err);
+ }).then(resolveFlightDataPromise);
}
}, 0);
Expand All @@ -61,6 +56,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
if (timeout) {
clearTimeout(timeout);
flushBufferedChunks(controller);
+ if (cancelled) return;
}
- controller.enqueue(encoder.encode("</body></html>"));
+ tryEnqueue(controller, encoder.encode("</body></html>"));
Expand All @@ -80,7 +76,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
});
}
diff --git a/dist/production/lib/rsc/html-stream/server.js b/dist/production/lib/rsc/html-stream/server.js
index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2b2f755a3 100644
index 326e0ea1136babf7a9ed03bb59087140069758bf..ccfef142cb56f08bd58caf0eeb40790d61e1f7a6 100644
--- a/dist/production/lib/rsc/html-stream/server.js
+++ b/dist/production/lib/rsc/html-stream/server.js
@@ -21,11 +21,31 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
Expand All @@ -94,9 +90,9 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
+ timeout = null;
+ }
+ buffered.length = 0;
+ resolveFlightDataPromise();
+ if (rscReader && rscStream.locked) await rscReader.cancel(reason).catch(() => {});
+ else await rscStream.cancel(reason).catch(() => {});
+ resolveFlightDataPromise();
+ }
+ function tryEnqueue(controller, chunk) {
+ try {
Expand All @@ -116,7 +112,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
}
buffered.length = 0;
timeout = null;
@@ -37,31 +57,32 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
@@ -37,31 +57,28 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
timeout = setTimeout(async () => {
if (cancelled) return;
flushBufferedChunks(controller);
Expand All @@ -126,12 +122,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
rscReader = rscStream.getReader();
- writeRSCStream(rscReader, controller, () => cancelled, nonce).catch((err) => controller.error(err)).then(resolveFlightDataPromise);
+ writeRSCStream(rscReader, controller, () => cancelled, nonce).catch((err) => {
+ if (cancelled) return;
+ try {
+ controller.error(err);
+ } catch (error) {
+ return stop(error);
+ }
+ if (!cancelled) controller.error(err);
+ }).then(resolveFlightDataPromise);
}
}, 0);
Expand All @@ -142,6 +133,7 @@ index 326e0ea1136babf7a9ed03bb59087140069758bf..a579d482b2536e7898279eb4f8801cc2
if (timeout) {
clearTimeout(timeout);
flushBufferedChunks(controller);
+ if (cancelled) return;
}
- controller.enqueue(encoder.encode("</body></html>"));
+ tryEnqueue(controller, encoder.encode("</body></html>"));
Expand Down
38 changes: 19 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading