@samitouri / QOS-React / commits / 68097787f6

DevTools should use reconciler version (rather than renderer version)

when available (#21269)

Brian Vaughn committed Apr 14, 2021 at 14:48 UTC 68097787f6e8f6d73af06e7c549a294df942b986
2 files changed +9 -1
packages/react-devtools-shared/src/backend/renderer.js
+7 -1
@@ -503,13 +503,19 @@ export function attach(
503 renderer: ReactRenderer,
504 global: Object,
505 ): RendererInterface {
506 + // Newer versions of the reconciler package also specific reconciler version.
507 + // If that version number is present, use it.
508 + // Third party renderer versions may not match the reconciler version,
509 + // and the latter is what's important in terms of tags and symbols.
510 + const version = renderer.reconcilerVersion || renderer.version;
511 +
512 const {
513 getDisplayNameForFiber,
514 getTypeSymbol,
515 ReactPriorityLevels,
516 ReactTypeOfWork,
517 ReactTypeOfSideEffect,
512 - } = getInternalReactConstants(renderer.version);
518 + } = getInternalReactConstants(version);
519 const {Incomplete, NoFlags, PerformedWork, Placement} = ReactTypeOfSideEffect;
520 const {
521 CacheComponent,
packages/react-devtools-shared/src/backend/types.js
+2
@@ -137,6 +137,8 @@ export type ReactRenderer = {
137 // Only injected by React v16.9+ in DEV mode.
138 // Enables DevTools to append owners-only component stack to error messages.
139 getCurrentFiber?: () => Fiber | null,
140 + // 17.0.2+
141 + reconcilerVersion?: string,
142 // Uniquely identifies React DOM v15.
143 ComponentTree?: any,
144 // Present for React DOM v12 (possibly earlier) through v15.