@@ -37,11 +37,9 @@ import type {
3737 RendererID ,
3838 RendererInterface ,
3939 ConsolePatchSettings ,
40+ DevToolsHookSettings ,
4041} from './types' ;
41- import type {
42- ComponentFilter ,
43- BrowserTheme ,
44- } from 'react-devtools-shared/src/frontend/types' ;
42+ import type { ComponentFilter } from 'react-devtools-shared/src/frontend/types' ;
4543import { isSynchronousXHRSupported , isReactNativeEnvironment } from './utils' ;
4644
4745const debug = ( methodName : string , ...args : Array < string > ) => {
@@ -152,6 +150,7 @@ export default class Agent extends EventEmitter<{
152150 traceUpdates : [ Set < HostInstance > ] ,
153151 drawTraceUpdates : [ Array < HostInstance > ] ,
154152 disableTraceUpdates : [ ] ,
153+ updateHookSettings : [ DevToolsHookSettings ] ,
155154} > {
156155 _bridge : BackendBridge ;
157156 _isProfiling : boolean = false ;
@@ -805,30 +804,22 @@ export default class Agent extends EventEmitter<{
805804 }
806805 } ;
807806
808- updateConsolePatchSettings : ( {
809- appendComponentStack : boolean ,
810- breakOnConsoleErrors : boolean ,
811- browserTheme : BrowserTheme ,
812- hideConsoleLogsInStrictMode : boolean ,
813- showInlineWarningsAndErrors : boolean ,
814- } ) = > void = ( {
815- appendComponentStack,
816- breakOnConsoleErrors,
817- showInlineWarningsAndErrors,
818- hideConsoleLogsInStrictMode,
819- browserTheme,
820- } : ConsolePatchSettings ) => {
807+ updateConsolePatchSettings : (
808+ settings : $ReadOnly < ConsolePatchSettings > ,
809+ ) = > void = settings => {
810+ // Propagate the settings, so Backend can subscribe to it and modify hook
811+ this . emit ( 'updateHookSettings' , {
812+ appendComponentStack : settings . appendComponentStack ,
813+ breakOnConsoleErrors : settings . breakOnConsoleErrors ,
814+ showInlineWarningsAndErrors : settings . showInlineWarningsAndErrors ,
815+ hideConsoleLogsInStrictMode : settings . hideConsoleLogsInStrictMode ,
816+ } ) ;
817+
821818 // If the frontend preferences have changed,
822819 // or in the case of React Native- if the backend is just finding out the preferences-
823820 // then reinstall the console overrides.
824821 // It's safe to call `patchConsole` multiple times.
825- patchConsole ( {
826- appendComponentStack,
827- breakOnConsoleErrors,
828- showInlineWarningsAndErrors,
829- hideConsoleLogsInStrictMode,
830- browserTheme,
831- } ) ;
822+ patchConsole ( settings ) ;
832823 } ;
833824
834825 updateComponentFilters : ( componentFilters : Array < ComponentFilter > ) => void =
0 commit comments