Skip to content

Commit c14a584

Browse files
committed
devtools: Display actual ReactDOM API name in root type
1 parent ea5c55a commit c14a584

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

packages/react-devtools-shared/src/__tests__/inspectedElement-test.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe('InspectedElement', () => {
176176
"a": 1,
177177
"b": "abc",
178178
},
179-
"rootType": "createLegacyRoot()",
179+
"rootType": "render()",
180180
"state": null,
181181
}
182182
`);
@@ -1585,7 +1585,7 @@ describe('InspectedElement', () => {
15851585
"a": 1,
15861586
"b": "abc",
15871587
},
1588-
"rootType": "createLegacyRoot()",
1588+
"rootType": "render()",
15891589
"state": null,
15901590
}
15911591
`);
@@ -1914,7 +1914,7 @@ describe('InspectedElement', () => {
19141914
"id": 2,
19151915
"owners": null,
19161916
"props": Object {},
1917-
"rootType": "createLegacyRoot()",
1917+
"rootType": "render()",
19181918
"state": null,
19191919
}
19201920
`);
@@ -1947,7 +1947,7 @@ describe('InspectedElement', () => {
19471947
"id": 2,
19481948
"owners": null,
19491949
"props": Object {},
1950-
"rootType": "createLegacyRoot()",
1950+
"rootType": "render()",
19511951
"state": null,
19521952
}
19531953
`);
@@ -1968,9 +1968,7 @@ describe('InspectedElement', () => {
19681968
}, false);
19691969

19701970
const inspectedElement = await inspectElementAtIndex(0);
1971-
expect(inspectedElement.rootType).toMatchInlineSnapshot(
1972-
`"createLegacyRoot()"`,
1973-
);
1971+
expect(inspectedElement.rootType).toMatchInlineSnapshot(`"hydrate()"`);
19741972
});
19751973

19761974
it('should display the root type for ReactDOM.render', async () => {
@@ -1982,9 +1980,7 @@ describe('InspectedElement', () => {
19821980
}, false);
19831981

19841982
const inspectedElement = await inspectElementAtIndex(0);
1985-
expect(inspectedElement.rootType).toMatchInlineSnapshot(
1986-
`"createLegacyRoot()"`,
1987-
);
1983+
expect(inspectedElement.rootType).toMatchInlineSnapshot(`"render()"`);
19881984
});
19891985

19901986
it('should display the root type for ReactDOM.hydrateRoot', async () => {
@@ -1997,7 +1993,7 @@ describe('InspectedElement', () => {
19971993
}, false);
19981994

19991995
const inspectedElement = await inspectElementAtIndex(0);
2000-
expect(inspectedElement.rootType).toMatchInlineSnapshot(`"createRoot()"`);
1996+
expect(inspectedElement.rootType).toMatchInlineSnapshot(`"hydrateRoot()"`);
20011997
});
20021998

20031999
it('should display the root type for ReactDOM.createRoot', async () => {

packages/react-reconciler/src/ReactFiberRoot.new.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ function FiberRootNode(containerInfo, tag, hydrate) {
8383
if (__DEV__) {
8484
switch (tag) {
8585
case ConcurrentRoot:
86-
this._debugRootType = 'createRoot()';
86+
this._debugRootType = hydrate ? 'hydrateRoot()' : 'createRoot()';
8787
break;
8888
case LegacyRoot:
89-
this._debugRootType = 'createLegacyRoot()';
89+
this._debugRootType = hydrate ? 'hydrate()' : 'render()';
9090
break;
9191
}
9292
}

packages/react-reconciler/src/ReactFiberRoot.old.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ function FiberRootNode(containerInfo, tag, hydrate) {
8383
if (__DEV__) {
8484
switch (tag) {
8585
case ConcurrentRoot:
86-
this._debugRootType = 'createRoot()';
86+
this._debugRootType = hydrate ? 'hydrateRoot()' : 'createRoot()';
8787
break;
8888
case LegacyRoot:
89-
this._debugRootType = 'createLegacyRoot()';
89+
this._debugRootType = hydrate ? 'hydrate()' : 'render()';
9090
break;
9191
}
9292
}

0 commit comments

Comments
 (0)