Skip to content

Commit

Permalink
chore: remove settings manager from react-devtools-core (#30986)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hoxyq committed Sep 18, 2024
1 parent f37c7bc commit f2c57a3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 148 deletions.
44 changes: 0 additions & 44 deletions packages/react-devtools-core/src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import {initBackend} from 'react-devtools-shared/src/backend';
import {__DEBUG__} from 'react-devtools-shared/src/constants';
import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
import {getDefaultComponentFilters} from 'react-devtools-shared/src/utils';
import {
initializeUsingCachedSettings,
cacheConsolePatchSettings,
type DevToolsSettingsManager,
} from './cachedSettings';

import type {BackendBridge} from 'react-devtools-shared/src/bridge';
import type {
Expand All @@ -37,7 +32,6 @@ type ConnectOptions = {
retryConnectionDelay?: number,
isAppActive?: () => boolean,
websocket?: ?WebSocket,
devToolsSettingsManager: ?DevToolsSettingsManager,
};

installHook(window);
Expand Down Expand Up @@ -72,7 +66,6 @@ export function connectToDevTools(options: ?ConnectOptions) {
resolveRNStyle = (null: $FlowFixMe),
retryConnectionDelay = 2000,
isAppActive = () => true,
devToolsSettingsManager,
} = options || {};

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

if (devToolsSettingsManager != null) {
try {
initializeUsingCachedSettings(devToolsSettingsManager);
} catch (e) {
// If we call a method on devToolsSettingsManager that throws, or if
// is invalid data read out, don't throw and don't interrupt initialization
console.error(e);
}
}

if (!isAppActive()) {
// If the app is in background, maybe retry later.
// Don't actually attempt to connect until we're in foreground.
Expand Down Expand Up @@ -161,15 +144,6 @@ export function connectToDevTools(options: ?ConnectOptions) {
},
);

if (devToolsSettingsManager != null && bridge != null) {
bridge.addListener('updateHookSettings', consolePatchSettings =>
cacheConsolePatchSettings(
devToolsSettingsManager,
consolePatchSettings,
),
);
}

// The renderer interface doesn't read saved component filters directly,
// because they are generally stored in localStorage within the context of the extension.
// Because of this it relies on the extension to pass filters.
Expand Down Expand Up @@ -314,7 +288,6 @@ type ConnectWithCustomMessagingOptions = {
onSubscribe: (cb: Function) => void,
onUnsubscribe: (cb: Function) => void,
onMessage: (event: string, payload: any) => void,
settingsManager: ?DevToolsSettingsManager,
nativeStyleEditorValidAttributes?: $ReadOnlyArray<string>,
resolveRNStyle?: ResolveNativeStyle,
};
Expand All @@ -323,7 +296,6 @@ export function connectWithCustomMessagingProtocol({
onSubscribe,
onUnsubscribe,
onMessage,
settingsManager,
nativeStyleEditorValidAttributes,
resolveRNStyle,
}: ConnectWithCustomMessagingOptions): Function {
Expand All @@ -332,16 +304,6 @@ export function connectWithCustomMessagingProtocol({
return;
}

if (settingsManager != null) {
try {
initializeUsingCachedSettings(settingsManager);
} catch (e) {
// If we call a method on devToolsSettingsManager that throws, or if
// is invalid data read out, don't throw and don't interrupt initialization
console.error(e);
}
}

const wall: Wall = {
listen(fn: Function) {
onSubscribe(fn);
Expand All @@ -367,12 +329,6 @@ export function connectWithCustomMessagingProtocol({
},
);

if (settingsManager != null) {
bridge.addListener('updateHookSettings', consolePatchSettings =>
cacheConsolePatchSettings(settingsManager, consolePatchSettings),
);
}

if (window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ == null) {
bridge.send('overrideComponentFilters', savedComponentFilters);
}
Expand Down
75 changes: 0 additions & 75 deletions packages/react-devtools-core/src/cachedSettings.js

This file was deleted.

26 changes: 0 additions & 26 deletions packages/react-devtools-shared/src/backend/console.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/react-devtools-shared/src/backend/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,3 @@ export type DevToolsHookSettings = {
showInlineWarningsAndErrors: boolean,
hideConsoleLogsInStrictMode: boolean,
};

// Will be removed together with console patching from backend/console.js to hook.js
export type ConsolePatchSettings = DevToolsHookSettings;

0 comments on commit f2c57a3

Please sign in to comment.