Skip to content

Commit

Permalink
DevTools should use reconciler version (rather than renderer version)
Browse files Browse the repository at this point in the history
when available (facebook#21269)
  • Loading branch information
Brian Vaughn authored and koto committed Jun 15, 2021
1 parent 9d95979 commit 33caddd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,19 @@ export function attach(
renderer: ReactRenderer,
global: Object,
): RendererInterface {
// Newer versions of the reconciler package also specific reconciler version.
// If that version number is present, use it.
// Third party renderer versions may not match the reconciler version,
// and the latter is what's important in terms of tags and symbols.
const version = renderer.reconcilerVersion || renderer.version;

const {
getDisplayNameForFiber,
getTypeSymbol,
ReactPriorityLevels,
ReactTypeOfWork,
ReactTypeOfSideEffect,
} = getInternalReactConstants(renderer.version);
} = getInternalReactConstants(version);
const {Incomplete, NoFlags, PerformedWork, Placement} = ReactTypeOfSideEffect;
const {
CacheComponent,
Expand Down
2 changes: 2 additions & 0 deletions packages/react-devtools-shared/src/backend/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export type ReactRenderer = {
// Only injected by React v16.9+ in DEV mode.
// Enables DevTools to append owners-only component stack to error messages.
getCurrentFiber?: () => Fiber | null,
// 17.0.2+
reconcilerVersion?: string,
// Uniquely identifies React DOM v15.
ComponentTree?: any,
// Present for React DOM v12 (possibly earlier) through v15.
Expand Down

0 comments on commit 33caddd

Please sign in to comment.