@samitouri / QOS-React / commits / eade0d0fb7

Attach instance handle to DOM in DEV for enableInternalInstanceMap (#35341)

Continue attaching `internalInstanceKey` to DOM nodes in DEV. This prevents breaking some internal dev tooling while we experiment with the broader change. Note that this does not reference the DOM handle within the flag, just attaches it and deletes it. Internals tracking is still done through the private map.

Jack Pope committed Dec 10, 2025 at 13:35 UTC eade0d0fb78e327c5624f53753126687f05c0d16
1 file changed +6
packages/react-dom-bindings/src/client/ReactDOMComponentTree.js
+6
@@ -75,6 +75,9 @@ export function detachDeletedInstance(node: Instance): void {
75 delete (node: any)[internalEventHandlerListenersKey];
76 delete (node: any)[internalEventHandlesSetKey];
77 delete (node: any)[internalRootNodeResourcesKey];
78 + if (__DEV__) {
79 + delete (node: any)[internalInstanceKey];
80 + }
81 return;
82 }
83 // TODO: This function is only called on host components. I don't think all of
@@ -97,6 +100,9 @@ export function precacheFiberNode(
100 ): void {
101 if (enableInternalInstanceMap) {
102 internalInstanceMap.set(node, hostInst);
103 + if (__DEV__) {
104 + (node: any)[internalInstanceKey] = hostInst;
105 + }
106 return;
107 }
108 (node: any)[internalInstanceKey] = hostInst;