GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Don't pass internals to callbacks (#21161) · react/react@1cf9978

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-server/src
    • ReactFizzServer.js
    • ReactFlightServer.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-server/src/ReactFizzServer.js‎

Copy file name to clipboardExpand all lines: packages/react-server/src/ReactFizzServer.js
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ function createPendingSegment(
263263
function reportError(request: Request, error: mixed): void {
264264
// If this callback errors, we intentionally let that error bubble up to become a fatal error
265265
// so that someone fixes the error reporting instead of hiding it.
266-
request.onError(error);
266+
const onError = request.onError;
267+
onError(error);
267268
}
268269

269270
function fatalError(request: Request, error: mixed): void {
@@ -485,7 +486,8 @@ function erroredTask(
485486

486487
request.allPendingTasks--;
487488
if (request.allPendingTasks === 0) {
488-
request.onCompleteAll();
489+
const onCompleteAll = request.onCompleteAll;
490+
onCompleteAll();
489491
}
490492
}
491493

@@ -532,7 +534,8 @@ function abortTask(task: Task): void {
532534
}
533535

534536
if (request.allPendingTasks === 0) {
535-
request.onCompleteAll();
537+
const onCompleteAll = request.onCompleteAll;
538+
onCompleteAll();
536539
}
537540
}
538541
}
@@ -552,7 +555,8 @@ function finishedTask(
552555
}
553556
request.pendingRootTasks--;
554557
if (request.pendingRootTasks === 0) {
555-
request.onReadyToStream();
558+
const onReadyToStream = request.onReadyToStream;
559+
onReadyToStream();
556560
}
557561
} else {
558562
boundary.pendingTasks--;
@@ -593,7 +597,8 @@ function finishedTask(
593597
if (request.allPendingTasks === 0) {
594598
// This needs to be called at the very end so that we can synchronously write the result
595599
// in the callback if needed.
596-
request.onCompleteAll();
600+
const onCompleteAll = request.onCompleteAll;
601+
onCompleteAll();
597602
}
598603
}
599604

Collapse file

‎packages/react-server/src/ReactFlightServer.js‎

Copy file name to clipboardExpand all lines: packages/react-server/src/ReactFlightServer.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ export function resolveModelToJSON(
599599
}
600600

601601
function reportError(request: Request, error: mixed): void {
602-
request.onError(error);
602+
const onError = request.onError;
603+
onError(error);
603604
}
604605

605606
function fatalError(request: Request, error: mixed): void {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.