Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove settings manager from react-devtools-core #30986

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading