diff --git a/packages/react-devtools-shared/src/devtools/views/DevTools.js b/packages/react-devtools-shared/src/devtools/views/DevTools.js index 91a17dcad2b..4b0671e899e 100644 --- a/packages/react-devtools-shared/src/devtools/views/DevTools.js +++ b/packages/react-devtools-shared/src/devtools/views/DevTools.js @@ -13,7 +13,14 @@ import '@reach/menu-button/styles.css'; import '@reach/tooltip/styles.css'; import * as React from 'react'; -import {useCallback, useEffect, useLayoutEffect, useMemo, useRef} from 'react'; +import { + StrictMode, + useCallback, + useEffect, + useLayoutEffect, + useMemo, + useRef, +} from 'react'; import Store from '../store'; import { BridgeContext, @@ -56,6 +63,38 @@ import type {BrowserTheme} from 'react-devtools-shared/src/frontend/types'; import type {ReactFunctionLocation, ReactCallSite} from 'shared/ReactTypes'; import type {SourceSelection} from './Editor/EditorPane'; +const MaybeActivity: any = + React.Activity || + (React as any).unstable_Activity || + function AlwaysVisibleActivity({ + children, + }: { + children: React.Node, + mode: string, + }) { + return children; + }; + +function TabContent({ + children, + activeTab, + name, +}: { + children: React.Node, + activeTab: string, + name: string, +}) { + const hidden = activeTab !== name; + const mode = hidden ? 'hidden' : 'visible'; + return ( + + + {children} + + + ); +} + export type TabID = 'components' | 'profiler' | 'suspense'; export type ViewElementSource = ( @@ -289,6 +328,7 @@ export default function DevTools({ useLayoutEffect(() => { return () => { try { + // TODO: can't be put int without being able to resume listening // Shut the Bridge down synchronously (during unmount). bridge.shutdown(); } catch (error) { @@ -302,98 +342,102 @@ export default function DevTools({ }, []); return ( - - - - - - - - - - - - - - - - - {showTabBar && ( - - - - {process.env.DEVTOOLS_VERSION} - - - - - )} - - - + + + + + + + + + + + + + + + + - + className={styles.DevTools} + ref={devToolsRef} + data-react-devtools-portal-root={true}> + {showTabBar && ( + + + + {process.env.DEVTOOLS_VERSION} + + + + + )} + + + + + + + + + - - - - - {editorPortalContainer ? ( - - ) : null} - - - - - - - - - - - - {warnIfLegacyBackendDetected && } - {warnIfUnsupportedVersionDetected && } - - - - - + ) : null} + + + + + + + + + + + + {warnIfLegacyBackendDetected && } + {warnIfUnsupportedVersionDetected && ( + + )} + + + + + + ); } diff --git a/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js b/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js index 020246e8a4a..924aa1497c1 100644 --- a/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js +++ b/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js @@ -28,7 +28,7 @@ function useCustomHook() { } function HookTreeCase() { - const onClick = useCustomHook(); + const [, , onClick] = useCustomHook(); return ; }