diff --git a/packages/react-devtools-shared/src/__tests__/__snapshots__/profilingCommitTreeBuilder-test.js.snap b/packages/react-devtools-shared/src/__tests__/__snapshots__/profilingCommitTreeBuilder-test.js.snap index b1a4a14818b56..1fa419013d98f 100644 --- a/packages/react-devtools-shared/src/__tests__/__snapshots__/profilingCommitTreeBuilder-test.js.snap +++ b/packages/react-devtools-shared/src/__tests__/__snapshots__/profilingCommitTreeBuilder-test.js.snap @@ -1,5 +1,341 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`commit tree Lazy should support Lazy components (createRoot): 0: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [ + 3, + ], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + 3 => Object { + "children": Array [], + "displayName": "Suspense", + "hocDisplayNames": null, + "id": 3, + "key": null, + "parentID": 2, + "treeBaseDuration": 0, + "type": 12, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components (createRoot): 1: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [ + 3, + ], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + 3 => Object { + "children": Array [ + 4, + ], + "displayName": "Suspense", + "hocDisplayNames": null, + "id": 3, + "key": null, + "parentID": 2, + "treeBaseDuration": 0, + "type": 12, + }, + 4 => Object { + "children": Array [], + "displayName": "LazyInnerComponent", + "hocDisplayNames": null, + "id": 4, + "key": null, + "parentID": 3, + "treeBaseDuration": 0, + "type": 5, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components (legacy render): 0: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [ + 3, + ], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + 3 => Object { + "children": Array [], + "displayName": "Suspense", + "hocDisplayNames": null, + "id": 3, + "key": null, + "parentID": 2, + "treeBaseDuration": 0, + "type": 12, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components (legacy render): 1: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [ + 3, + ], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + 3 => Object { + "children": Array [ + 4, + ], + "displayName": "Suspense", + "hocDisplayNames": null, + "id": 3, + "key": null, + "parentID": 2, + "treeBaseDuration": 0, + "type": 12, + }, + 4 => Object { + "children": Array [], + "displayName": "LazyInnerComponent", + "hocDisplayNames": null, + "id": 4, + "key": null, + "parentID": 3, + "treeBaseDuration": 0, + "type": 5, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components that are unmounted before resolving (createRoot): 0: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [ + 3, + ], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + 3 => Object { + "children": Array [], + "displayName": "Suspense", + "hocDisplayNames": null, + "id": 3, + "key": null, + "parentID": 2, + "treeBaseDuration": 0, + "type": 12, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components that are unmounted before resolving (createRoot): 1: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components that are unmounted before resolving (legacy render): 0: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [ + 3, + ], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + 3 => Object { + "children": Array [], + "displayName": "Suspense", + "hocDisplayNames": null, + "id": 3, + "key": null, + "parentID": 2, + "treeBaseDuration": 0, + "type": 12, + }, + }, + "rootID": 1, +} +`; + +exports[`commit tree Lazy should support Lazy components that are unmounted before resolving (legacy render): 1: CommitTree 1`] = ` +Object { + "nodes": Map { + 1 => Object { + "children": Array [ + 2, + ], + "displayName": null, + "hocDisplayNames": null, + "id": 1, + "key": null, + "parentID": 0, + "treeBaseDuration": 0, + "type": 11, + }, + 2 => Object { + "children": Array [], + "displayName": "App", + "hocDisplayNames": null, + "id": 2, + "key": null, + "parentID": 1, + "treeBaseDuration": 0, + "type": 5, + }, + }, + "rootID": 1, +} +`; + exports[`commit tree should be able to rebuild the store tree for each commit: 0: CommitTree 1`] = ` Object { "nodes": Map { diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index f8e0f07104ac9..c4ea0cf1a1e93 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -180,6 +180,7 @@ export function getInternalReactConstants( ForwardRef: 11, Fragment: 7, FunctionComponent: 0, + FundamentalComponent: 20, // Experimental HostComponent: 5, HostPortal: 4, HostRoot: 3, @@ -238,6 +239,7 @@ export function getInternalReactConstants( ForwardRef: 11, Fragment: 7, FunctionComponent: 0, + FundamentalComponent: -1, // Experimental HostComponent: 5, HostPortal: 4, HostRoot: 3, @@ -267,6 +269,7 @@ export function getInternalReactConstants( ForwardRef: 13, Fragment: 9, FunctionComponent: 0, + FundamentalComponent: -1, // Experimental HostComponent: 7, HostPortal: 6, HostRoot: 5, @@ -296,6 +299,7 @@ export function getInternalReactConstants( ForwardRef: 14, Fragment: 10, FunctionComponent: 1, + FundamentalComponent: -1, // Experimental HostComponent: 5, HostPortal: 4, HostRoot: 3, @@ -335,6 +339,7 @@ export function getInternalReactConstants( FunctionComponent, IndeterminateComponent, ForwardRef, + FundamentalComponent, HostRoot, HostComponent, HostPortal, diff --git a/packages/react-devtools-shared/src/backend/types.js b/packages/react-devtools-shared/src/backend/types.js index d87c2fdf97b2e..7b267bc531fa2 100644 --- a/packages/react-devtools-shared/src/backend/types.js +++ b/packages/react-devtools-shared/src/backend/types.js @@ -35,6 +35,7 @@ export type WorkTagMap = {| ForwardRef: WorkTag, Fragment: WorkTag, FunctionComponent: WorkTag, + FundamentalComponent: WorkTag, HostComponent: WorkTag, HostPortal: WorkTag, HostRoot: WorkTag,