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 — Add missing null checks to OffscreenInstance code (#24846) · react/react@c1f5884

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-reconciler/src
    • ReactFiberCommitWork.new.js
    • ReactFiberCommitWork.old.js
    • ReactFiberTracingMarkerComponent.new.js
    • ReactFiberTracingMarkerComponent.old.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-reconciler/src/ReactFiberCommitWork.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCommitWork.new.js
+24-7Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import type {Wakeable} from 'shared/ReactTypes';
2525
import type {
2626
OffscreenState,
2727
OffscreenInstance,
28+
OffscreenQueue,
2829
} from './ReactFiberOffscreenComponent';
2930
import type {HookFlags} from './ReactHookEffectTags';
3031
import type {Cache} from './ReactFiberCacheComponent.new';
@@ -2877,8 +2878,8 @@ function commitPassiveMountOnFiber(
28772878

28782879
if (enableTransitionTracing) {
28792880
const isFallback = finishedWork.memoizedState;
2880-
const queue = (finishedWork.updateQueue: any);
2881-
const instance = finishedWork.stateNode;
2881+
const queue: OffscreenQueue = (finishedWork.updateQueue: any);
2882+
const instance: OffscreenInstance = finishedWork.stateNode;
28822883

28832884
if (queue !== null) {
28842885
if (isFallback) {
@@ -2896,7 +2897,11 @@ function commitPassiveMountOnFiber(
28962897
// Add all the transitions saved in the update queue during
28972898
// the render phase (ie the transitions associated with this boundary)
28982899
// into the transitions set.
2899-
prevTransitions.add(transition);
2900+
if (prevTransitions === null) {
2901+
// TODO: What if prevTransitions is null?
2902+
} else {
2903+
prevTransitions.add(transition);
2904+
}
29002905
});
29012906
}
29022907

@@ -2913,10 +2918,22 @@ function commitPassiveMountOnFiber(
29132918
// caused them
29142919
if (markerTransitions !== null) {
29152920
markerTransitions.forEach(transition => {
2916-
if (instance.transitions.has(transition)) {
2917-
instance.pendingMarkers.add(
2918-
markerInstance.pendingSuspenseBoundaries,
2919-
);
2921+
if (instance.transitions === null) {
2922+
// TODO: What if instance.transitions is null?
2923+
} else {
2924+
if (instance.transitions.has(transition)) {
2925+
if (
2926+
instance.pendingMarkers === null ||
2927+
markerInstance.pendingSuspenseBoundaries === null
2928+
) {
2929+
// TODO: What if instance.pendingMarkers is null?
2930+
// TODO: What if markerInstance.pendingSuspenseBoundaries is null?
2931+
} else {
2932+
instance.pendingMarkers.add(
2933+
markerInstance.pendingSuspenseBoundaries,
2934+
);
2935+
}
2936+
}
29202937
}
29212938
});
29222939
}
Collapse file

‎packages/react-reconciler/src/ReactFiberCommitWork.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCommitWork.old.js
+24-7Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import type {Wakeable} from 'shared/ReactTypes';
2525
import type {
2626
OffscreenState,
2727
OffscreenInstance,
28+
OffscreenQueue,
2829
} from './ReactFiberOffscreenComponent';
2930
import type {HookFlags} from './ReactHookEffectTags';
3031
import type {Cache} from './ReactFiberCacheComponent.old';
@@ -2877,8 +2878,8 @@ function commitPassiveMountOnFiber(
28772878

28782879
if (enableTransitionTracing) {
28792880
const isFallback = finishedWork.memoizedState;
2880-
const queue = (finishedWork.updateQueue: any);
2881-
const instance = finishedWork.stateNode;
2881+
const queue: OffscreenQueue = (finishedWork.updateQueue: any);
2882+
const instance: OffscreenInstance = finishedWork.stateNode;
28822883

28832884
if (queue !== null) {
28842885
if (isFallback) {
@@ -2896,7 +2897,11 @@ function commitPassiveMountOnFiber(
28962897
// Add all the transitions saved in the update queue during
28972898
// the render phase (ie the transitions associated with this boundary)
28982899
// into the transitions set.
2899-
prevTransitions.add(transition);
2900+
if (prevTransitions === null) {
2901+
// TODO: What if prevTransitions is null?
2902+
} else {
2903+
prevTransitions.add(transition);
2904+
}
29002905
});
29012906
}
29022907

@@ -2913,10 +2918,22 @@ function commitPassiveMountOnFiber(
29132918
// caused them
29142919
if (markerTransitions !== null) {
29152920
markerTransitions.forEach(transition => {
2916-
if (instance.transitions.has(transition)) {
2917-
instance.pendingMarkers.add(
2918-
markerInstance.pendingSuspenseBoundaries,
2919-
);
2921+
if (instance.transitions === null) {
2922+
// TODO: What if instance.transitions is null?
2923+
} else {
2924+
if (instance.transitions.has(transition)) {
2925+
if (
2926+
instance.pendingMarkers === null ||
2927+
markerInstance.pendingSuspenseBoundaries === null
2928+
) {
2929+
// TODO: What if instance.pendingMarkers is null?
2930+
// TODO: What if markerInstance.pendingSuspenseBoundaries is null?
2931+
} else {
2932+
instance.pendingMarkers.add(
2933+
markerInstance.pendingSuspenseBoundaries,
2934+
);
2935+
}
2936+
}
29202937
}
29212938
});
29222939
}
Collapse file

‎packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type BatchConfigTransition = {
4343
export type TracingMarkerInstance = {|
4444
pendingSuspenseBoundaries: PendingSuspenseBoundaries | null,
4545
transitions: Set<Transition> | null,
46-
|} | null;
46+
|};
4747

4848
export type PendingSuspenseBoundaries = Map<OffscreenInstance, SuspenseInfo>;
4949

Collapse file

‎packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type BatchConfigTransition = {
4343
export type TracingMarkerInstance = {|
4444
pendingSuspenseBoundaries: PendingSuspenseBoundaries | null,
4545
transitions: Set<Transition> | null,
46-
|} | null;
46+
|};
4747

4848
export type PendingSuspenseBoundaries = Map<OffscreenInstance, SuspenseInfo>;
4949

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.