@@ -120,6 +120,7 @@ import {
120120 MEMO_SYMBOL_STRING ,
121121 SERVER_CONTEXT_SYMBOL_STRING ,
122122 LAZY_SYMBOL_STRING ,
123+ REACT_OPTIMISTIC_KEY ,
123124} from '../shared/ReactSymbols' ;
124125import { enableStyleXFeatures } from 'react-devtools-feature-flags' ;
125126
@@ -4849,7 +4850,10 @@ export function attach(
48494850 }
48504851 let previousSiblingOfBestMatch = null;
48514852 let bestMatch = remainingReconcilingChildren;
4852- if (componentInfo.key != null) {
4853+ if (
4854+ componentInfo.key != null &&
4855+ componentInfo.key !== REACT_OPTIMISTIC_KEY
4856+ ) {
48534857 // If there is a key try to find a matching key in the set.
48544858 bestMatch = remainingReconcilingChildren;
48554859 while (bestMatch !== null) {
@@ -6145,7 +6149,7 @@ export function attach(
61456149 return {
61466150 displayName: getDisplayNameForFiber(fiber) || 'Anonymous',
61476151 id: instance.id,
6148- key: fiber.key,
6152+ key: fiber.key === REACT_OPTIMISTIC_KEY ? null : fiber.key ,
61496153 env: null,
61506154 stack:
61516155 fiber._debugOwner == null || fiber._debugStack == null
@@ -6158,7 +6162,11 @@ export function attach(
61586162 return {
61596163 displayName: componentInfo.name || 'Anonymous',
61606164 id: instance.id,
6161- key: componentInfo.key == null ? null : componentInfo.key,
6165+ key:
6166+ componentInfo.key == null ||
6167+ componentInfo.key === REACT_OPTIMISTIC_KEY
6168+ ? null
6169+ : componentInfo.key,
61626170 env: componentInfo.env == null ? null : componentInfo.env,
61636171 stack:
61646172 componentInfo.owner == null || componentInfo.debugStack == null
@@ -7082,7 +7090,7 @@ export function attach(
70827090 // Does the component have legacy context attached to it.
70837091 hasLegacyContext,
70847092
7085- key: key != null ? key : null,
7093+ key: key != null && key !== REACT_OPTIMISTIC_KEY ? key : null,
70867094
70877095 type: elementType,
70887096
@@ -8641,15 +8649,19 @@ export function attach(
86418649 }
86428650 return {
86438651 displayName,
8644- key,
8652+ key : key === REACT_OPTIMISTIC_KEY ? null : key ,
86458653 index,
86468654 } ;
86478655 }
86488656
86498657 function getVirtualPathFrame ( virtualInstance : VirtualInstance ) : PathFrame {
86508658 return {
86518659 displayName : virtualInstance . data . name || '' ,
8652- key : virtualInstance . data . key == null ? null : virtualInstance . data . key ,
8660+ key :
8661+ virtualInstance . data . key == null ||
8662+ virtualInstance . data . key === REACT_OPTIMISTIC_KEY
8663+ ? null
8664+ : virtualInstance . data . key ,
86538665 index : - 1 , // We use -1 to indicate that this is a virtual path frame.
86548666 } ;
86558667 }
0 commit comments