@@ -20,18 +20,14 @@ import {
2020import  { 
2121  LOCAL_STORAGE_BROWSER_THEME , 
2222  LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY , 
23-   LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS , 
24-   LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY , 
2523  LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY , 
26-   LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY , 
27-   LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE , 
2824}  from  'react-devtools-shared/src/constants' ; 
2925import  { 
3026  COMFORTABLE_LINE_HEIGHT , 
3127  COMPACT_LINE_HEIGHT , 
3228}  from  'react-devtools-shared/src/devtools/constants' ; 
33- import  { useLocalStorage }  from  '../hooks' ; 
34- import  { BridgeContext }  from  '../context' ; 
29+ import  { useDevToolsHookSettings ,   useLocalStorage }  from  '../hooks' ; 
30+ import  { BridgeContext ,   StoreContext }  from  '../context' ; 
3531import  { logEvent }  from  'react-devtools-shared/src/Logger' ; 
3632
3733import  type  { BrowserTheme }  from  'react-devtools-shared/src/frontend/types' ; 
@@ -108,6 +104,7 @@ function SettingsContextController({
108104  profilerPortalContainer, 
109105} : Props ) : React . Node  { 
110106  const  bridge  =  useContext ( BridgeContext ) ; 
107+   const  store  =  useContext ( StoreContext ) ; 
111108
112109  const  [ displayDensity ,  setDisplayDensity ]  = 
113110    useLocalStorageWithLog < DisplayDensity > ( 
@@ -118,36 +115,27 @@ function SettingsContextController({
118115    LOCAL_STORAGE_BROWSER_THEME , 
119116    'auto' , 
120117  ) ; 
121-   const  [ appendComponentStack ,  setAppendComponentStack ]  = 
122-     useLocalStorageWithLog < boolean > ( 
123-       LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY , 
124-       true , 
125-     ) ; 
126-   const  [ breakOnConsoleErrors ,  setBreakOnConsoleErrors ]  = 
127-     useLocalStorageWithLog < boolean > ( 
128-       LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS , 
129-       false , 
130-     ) ; 
131118  const  [ parseHookNames ,  setParseHookNames ]  =  useLocalStorageWithLog < boolean > ( 
132119    LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY , 
133120    false , 
134121  ) ; 
135-   const  [ hideConsoleLogsInStrictMode ,  setHideConsoleLogsInStrictMode ]  = 
136-     useLocalStorageWithLog < boolean > ( 
137-       LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE , 
138-       false , 
139-     ) ; 
140-   const  [ showInlineWarningsAndErrors ,  setShowInlineWarningsAndErrors ]  = 
141-     useLocalStorageWithLog < boolean > ( 
142-       LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY , 
143-       true , 
144-     ) ; 
145122  const  [ traceUpdatesEnabled ,  setTraceUpdatesEnabled ]  = 
146123    useLocalStorageWithLog < boolean > ( 
147124      LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY , 
148125      false , 
149126    ) ; 
150127
128+   const  { 
129+     appendComponentStack, 
130+     setAppendComponentStack, 
131+     breakOnConsoleErrors, 
132+     setBreakOnConsoleErrors, 
133+     hideConsoleLogsInStrictMode, 
134+     setHideConsoleLogsInStrictMode, 
135+     showInlineWarningsAndErrors, 
136+     setShowInlineWarningsAndErrors, 
137+   }  =  useDevToolsHookSettings ( store ) ; 
138+ 
151139  const  documentElements  =  useMemo < DocumentElements > ( ( )  =>  { 
152140    const  array : Array < HTMLElement >  = [
153141      ((document.documentElement: any): HTMLElement),
@@ -197,14 +185,14 @@ function SettingsContextController({
197185  } ,  [ browserTheme ,  theme ,  documentElements ] ) ; 
198186
199187  useEffect ( ( )  =>  { 
200-     bridge . send ( ' updateConsolePatchSettings' ,   { 
188+     store . updateConsolePatchSettings ( { 
201189      appendComponentStack, 
202190      breakOnConsoleErrors, 
203191      showInlineWarningsAndErrors, 
204192      hideConsoleLogsInStrictMode, 
205193    } ) ; 
206194  } ,  [ 
207-     bridge , 
195+     store , 
208196    appendComponentStack , 
209197    breakOnConsoleErrors , 
210198    showInlineWarningsAndErrors , 
0 commit comments