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 — Clean up host pointers in level 2 of clean-up flag (#21112) · react/react@5f21a9f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-reconciler/src
    • ReactFiberCommitWork.new.js
    • ReactFiberCommitWork.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
+12-9Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,18 @@ function detachFiberAfterEffects(fiber: Fiber) {
12511251
fiber.deletions = null;
12521252
fiber.sibling = null;
12531253

1254+
// The `stateNode` is cyclical because on host nodes it points to the host
1255+
// tree, which has its own pointers to children, parents, and siblings.
1256+
// The other host nodes also point back to fibers, so we should detach that
1257+
// one, too.
1258+
if (fiber.tag === HostComponent) {
1259+
const hostInstance: Instance = fiber.stateNode;
1260+
if (hostInstance !== null) {
1261+
detachDeletedInstance(hostInstance);
1262+
}
1263+
}
1264+
fiber.stateNode = null;
1265+
12541266
// I'm intentionally not clearing the `return` field in this level. We
12551267
// already disconnect the `return` pointer at the root of the deleted
12561268
// subtree (in `detachFiberMutation`). Besides, `return` by itself is not
@@ -1269,15 +1281,6 @@ function detachFiberAfterEffects(fiber: Fiber) {
12691281
// The purpose of this branch is to be super aggressive so we can measure
12701282
// if there's any difference in memory impact. If there is, that could
12711283
// indicate a React leak we don't know about.
1272-
1273-
// For host components, disconnect host instance -> fiber pointer.
1274-
if (fiber.tag === HostComponent) {
1275-
const hostInstance: Instance = fiber.stateNode;
1276-
if (hostInstance !== null) {
1277-
detachDeletedInstance(hostInstance);
1278-
}
1279-
}
1280-
12811284
fiber.return = null;
12821285
fiber.dependencies = null;
12831286
fiber.memoizedProps = null;
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCommitWork.old.js
+12-9Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,18 @@ function detachFiberAfterEffects(fiber: Fiber) {
12511251
fiber.deletions = null;
12521252
fiber.sibling = null;
12531253

1254+
// The `stateNode` is cyclical because on host nodes it points to the host
1255+
// tree, which has its own pointers to children, parents, and siblings.
1256+
// The other host nodes also point back to fibers, so we should detach that
1257+
// one, too.
1258+
if (fiber.tag === HostComponent) {
1259+
const hostInstance: Instance = fiber.stateNode;
1260+
if (hostInstance !== null) {
1261+
detachDeletedInstance(hostInstance);
1262+
}
1263+
}
1264+
fiber.stateNode = null;
1265+
12541266
// I'm intentionally not clearing the `return` field in this level. We
12551267
// already disconnect the `return` pointer at the root of the deleted
12561268
// subtree (in `detachFiberMutation`). Besides, `return` by itself is not
@@ -1269,15 +1281,6 @@ function detachFiberAfterEffects(fiber: Fiber) {
12691281
// The purpose of this branch is to be super aggressive so we can measure
12701282
// if there's any difference in memory impact. If there is, that could
12711283
// indicate a React leak we don't know about.
1272-
1273-
// For host components, disconnect host instance -> fiber pointer.
1274-
if (fiber.tag === HostComponent) {
1275-
const hostInstance: Instance = fiber.stateNode;
1276-
if (hostInstance !== null) {
1277-
detachDeletedInstance(hostInstance);
1278-
}
1279-
}
1280-
12811284
fiber.return = null;
12821285
fiber.dependencies = null;
12831286
fiber.memoizedProps = null;

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.