@@ -38,11 +38,9 @@ import type {
3838 RendererID ,
3939 RendererInterface ,
4040 ConsolePatchSettings ,
41+ DevToolsHookSettings ,
4142} from './types' ;
42- import type {
43- ComponentFilter ,
44- BrowserTheme ,
45- } from 'react-devtools-shared/src/frontend/types' ;
43+ import type { ComponentFilter } from 'react-devtools-shared/src/frontend/types' ;
4644import { isSynchronousXHRSupported , isReactNativeEnvironment } from './utils' ;
4745
4846const debug = ( methodName : string , ...args : Array < string > ) => {
@@ -153,6 +151,7 @@ export default class Agent extends EventEmitter<{
153151 traceUpdates : [ Set < HostInstance > ] ,
154152 drawTraceUpdates : [ Array < HostInstance > ] ,
155153 disableTraceUpdates : [ ] ,
154+ updateHookSettings : [ DevToolsHookSettings ] ,
156155} > {
157156 _bridge : BackendBridge ;
158157 _isProfiling : boolean = false ;
@@ -762,30 +761,22 @@ export default class Agent extends EventEmitter<{
762761 }
763762 } ;
764763
765- updateConsolePatchSettings : ( {
766- appendComponentStack : boolean ,
767- breakOnConsoleErrors : boolean ,
768- browserTheme : BrowserTheme ,
769- hideConsoleLogsInStrictMode : boolean ,
770- showInlineWarningsAndErrors : boolean ,
771- } ) = > void = ( {
772- appendComponentStack,
773- breakOnConsoleErrors,
774- showInlineWarningsAndErrors,
775- hideConsoleLogsInStrictMode,
776- browserTheme,
777- } : ConsolePatchSettings ) => {
764+ updateConsolePatchSettings : (
765+ settings : $ReadOnly < ConsolePatchSettings > ,
766+ ) = > void = settings => {
767+ // Propagate the settings, so Backend can subscribe to it and modify hook
768+ this . emit ( 'updateHookSettings' , {
769+ appendComponentStack : settings . appendComponentStack ,
770+ breakOnConsoleErrors : settings . breakOnConsoleErrors ,
771+ showInlineWarningsAndErrors : settings . showInlineWarningsAndErrors ,
772+ hideConsoleLogsInStrictMode : settings . hideConsoleLogsInStrictMode ,
773+ } ) ;
774+
778775 // If the frontend preferences have changed,
779776 // or in the case of React Native- if the backend is just finding out the preferences-
780777 // then reinstall the console overrides.
781778 // It's safe to call `patchConsole` multiple times.
782- patchConsole ( {
783- appendComponentStack,
784- breakOnConsoleErrors,
785- showInlineWarningsAndErrors,
786- hideConsoleLogsInStrictMode,
787- browserTheme,
788- } ) ;
779+ patchConsole ( settings ) ;
789780 } ;
790781
791782 updateComponentFilters : ( componentFilters : Array < ComponentFilter > ) => void =
0 commit comments