@@ -10,13 +10,19 @@ import { type DebuggerState } from '../types';
1010import { Bubble , IndexedStack , Panel , SearchBar } from './components' ;
1111
1212namespace Xenon {
13- interface Methods {
13+ export interface Methods {
1414 isVisible ( ) : boolean ;
1515 show ( ) : void ;
1616 hide ( ) : void ;
1717 }
1818
19- interface Props {
19+ export interface Props {
20+ children : ReactNode ;
21+ /**
22+ * If true, completely disables the debugger by rendering only the children components without any debugging functionality.
23+ * @default false
24+ */
25+ disabled ?: boolean ;
2026 /**
2127 * Determines whether the network inspector is automatically enabled upon initialization.
2228 * @default true
@@ -45,23 +51,14 @@ namespace Xenon {
4551 includeDomains ?: string [ ] ;
4652 }
4753
48- interface WrapperProps extends Props {
49- /**
50- * If true, completely disables the debugger by rendering only the children components without any debugging functionality.
51- * @default false
52- */
53- disabled ?: boolean ;
54- children : ReactNode ;
55- }
56-
5754 enableMapSet ( ) ;
5855 const ref = createRef < Methods > ( ) ;
5956
6057 /**
6158 * Checks whether the debugger is currently visible.
6259 * @returns `true` if the debugger is currently visible, otherwise `false`.
6360 */
64- export const isVisible = ( ) => ref . current ?. isVisible ( ) ?? false ;
61+ export const isVisible = ( ) : boolean => ref . current ?. isVisible ( ) ?? false ;
6562
6663 /**
6764 * Makes the debugger visible. If it is already visible, this method has no additional effect.
@@ -75,14 +72,14 @@ namespace Xenon {
7572 */
7673 export const hide = ( ) : void => ref . current ?. hide ( ) ;
7774
78- const Debugger = memo (
75+ const Debugger = memo < Omit < Props , 'children' | 'disabled' > > (
7976 ( {
8077 autoInspectNetworkEnabled = true ,
8178 autoInspectConsoleEnabled = true ,
8279 bubbleSize = 40 ,
8380 idleBubbleOpacity = 0.5 ,
8481 includeDomains,
85- } : Props ) => {
82+ } ) => {
8683 const dimensions = useWindowDimensions ( ) ;
8784
8885 const [ debuggerState , setDebuggerState ] = useImmer < DebuggerState > ( {
@@ -142,9 +139,15 @@ namespace Xenon {
142139 </ MainContext . Provider >
143140 ) ;
144141 } ,
142+ ( prevProps , nextProps ) =>
143+ prevProps . autoInspectNetworkEnabled === nextProps . autoInspectNetworkEnabled &&
144+ prevProps . autoInspectConsoleEnabled === nextProps . autoInspectConsoleEnabled &&
145+ prevProps . bubbleSize === nextProps . bubbleSize &&
146+ prevProps . idleBubbleOpacity === nextProps . idleBubbleOpacity &&
147+ JSON . stringify ( prevProps . includeDomains ) === JSON . stringify ( nextProps . includeDomains ) ,
145148 ) ;
146149
147- export function Wrapper ( { disabled = false , children, ...props } : WrapperProps ) : JSX . Element {
150+ export function Wrapper ( { disabled = false , children, ...props } : Props ) : JSX . Element {
148151 if ( disabled ) return children as JSX . Element ;
149152
150153 return (
0 commit comments