Skip to content

Commit f2c57a3

Browse files
authored
chore: remove settings manager from react-devtools-core (#30986)
Stacked on #30636. See [this commit](20cec76). This has been only used for React Native and will be replaced by another approach (initialization via `installHook` call) in the next PR.
1 parent f37c7bc commit f2c57a3

File tree

4 files changed

+0
-148
lines changed

4 files changed

+0
-148
lines changed

packages/react-devtools-core/src/backend.js

-44
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import {initBackend} from 'react-devtools-shared/src/backend';
1414
import {__DEBUG__} from 'react-devtools-shared/src/constants';
1515
import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
1616
import {getDefaultComponentFilters} from 'react-devtools-shared/src/utils';
17-
import {
18-
initializeUsingCachedSettings,
19-
cacheConsolePatchSettings,
20-
type DevToolsSettingsManager,
21-
} from './cachedSettings';
2217

2318
import type {BackendBridge} from 'react-devtools-shared/src/bridge';
2419
import type {
@@ -37,7 +32,6 @@ type ConnectOptions = {
3732
retryConnectionDelay?: number,
3833
isAppActive?: () => boolean,
3934
websocket?: ?WebSocket,
40-
devToolsSettingsManager: ?DevToolsSettingsManager,
4135
};
4236

4337
installHook(window);
@@ -72,7 +66,6 @@ export function connectToDevTools(options: ?ConnectOptions) {
7266
resolveRNStyle = (null: $FlowFixMe),
7367
retryConnectionDelay = 2000,
7468
isAppActive = () => true,
75-
devToolsSettingsManager,
7669
} = options || {};
7770

7871
const protocol = useHttps ? 'wss' : 'ws';
@@ -88,16 +81,6 @@ export function connectToDevTools(options: ?ConnectOptions) {
8881
}
8982
}
9083

91-
if (devToolsSettingsManager != null) {
92-
try {
93-
initializeUsingCachedSettings(devToolsSettingsManager);
94-
} catch (e) {
95-
// If we call a method on devToolsSettingsManager that throws, or if
96-
// is invalid data read out, don't throw and don't interrupt initialization
97-
console.error(e);
98-
}
99-
}
100-
10184
if (!isAppActive()) {
10285
// If the app is in background, maybe retry later.
10386
// Don't actually attempt to connect until we're in foreground.
@@ -161,15 +144,6 @@ export function connectToDevTools(options: ?ConnectOptions) {
161144
},
162145
);
163146

164-
if (devToolsSettingsManager != null && bridge != null) {
165-
bridge.addListener('updateHookSettings', consolePatchSettings =>
166-
cacheConsolePatchSettings(
167-
devToolsSettingsManager,
168-
consolePatchSettings,
169-
),
170-
);
171-
}
172-
173147
// The renderer interface doesn't read saved component filters directly,
174148
// because they are generally stored in localStorage within the context of the extension.
175149
// Because of this it relies on the extension to pass filters.
@@ -314,7 +288,6 @@ type ConnectWithCustomMessagingOptions = {
314288
onSubscribe: (cb: Function) => void,
315289
onUnsubscribe: (cb: Function) => void,
316290
onMessage: (event: string, payload: any) => void,
317-
settingsManager: ?DevToolsSettingsManager,
318291
nativeStyleEditorValidAttributes?: $ReadOnlyArray<string>,
319292
resolveRNStyle?: ResolveNativeStyle,
320293
};
@@ -323,7 +296,6 @@ export function connectWithCustomMessagingProtocol({
323296
onSubscribe,
324297
onUnsubscribe,
325298
onMessage,
326-
settingsManager,
327299
nativeStyleEditorValidAttributes,
328300
resolveRNStyle,
329301
}: ConnectWithCustomMessagingOptions): Function {
@@ -332,16 +304,6 @@ export function connectWithCustomMessagingProtocol({
332304
return;
333305
}
334306

335-
if (settingsManager != null) {
336-
try {
337-
initializeUsingCachedSettings(settingsManager);
338-
} catch (e) {
339-
// If we call a method on devToolsSettingsManager that throws, or if
340-
// is invalid data read out, don't throw and don't interrupt initialization
341-
console.error(e);
342-
}
343-
}
344-
345307
const wall: Wall = {
346308
listen(fn: Function) {
347309
onSubscribe(fn);
@@ -367,12 +329,6 @@ export function connectWithCustomMessagingProtocol({
367329
},
368330
);
369331

370-
if (settingsManager != null) {
371-
bridge.addListener('updateHookSettings', consolePatchSettings =>
372-
cacheConsolePatchSettings(settingsManager, consolePatchSettings),
373-
);
374-
}
375-
376332
if (window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ == null) {
377333
bridge.send('overrideComponentFilters', savedComponentFilters);
378334
}

packages/react-devtools-core/src/cachedSettings.js

-75
This file was deleted.

packages/react-devtools-shared/src/backend/console.js

-26
This file was deleted.

packages/react-devtools-shared/src/backend/types.js

-3
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,3 @@ export type DevToolsHookSettings = {
534534
showInlineWarningsAndErrors: boolean,
535535
hideConsoleLogsInStrictMode: boolean,
536536
};
537-
538-
// Will be removed together with console patching from backend/console.js to hook.js
539-
export type ConsolePatchSettings = DevToolsHookSettings;

0 commit comments

Comments
 (0)