mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
8fbd307942
Fixes https://github.com/facebook/react/issues/27119, https://github.com/facebook/react/issues/27185. Fixed: - React DevTools now works as expected when user performs in-tab navigation, previously it was just stuck. https://github.com/facebook/react/assets/28902667/b11c5f84-7155-47a5-8b5a-7e90baca5347 - When user closes browser DevTools panel, we now do some cleanup to disconnect ports and emit shutdown event for bridge. This should fix the issue with registering duplicated fibers with the same id in Store. Changed: - We reconnect proxy port once in 25 seconds, in order to [keep service worker alive](https://developer.chrome.com/docs/extensions/whatsnew/#m110-sw-idle). - Instead of unregistering dynamically injected content scripts, wen now get list of already registered scripts and filter them out from scripts that we want to inject again, see dynamicallyInjectContentScripts.js. - Split `main.js` and `background.js` into multiple files. Tested on Chromium and Firefox browsers.
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
/* global chrome */
|
|
|
|
import {
|
|
getAppendComponentStack,
|
|
getBreakOnConsoleErrors,
|
|
getSavedComponentFilters,
|
|
getShowInlineWarningsAndErrors,
|
|
getHideConsoleLogsInStrictMode,
|
|
} from 'react-devtools-shared/src/utils';
|
|
import {getBrowserTheme} from 'react-devtools-extensions/src/utils';
|
|
|
|
// The renderer interface can't read saved component filters directly,
|
|
// because they are stored in localStorage within the context of the extension.
|
|
// Instead it relies on the extension to pass filters through.
|
|
function syncSavedPreferences() {
|
|
chrome.devtools.inspectedWindow.eval(
|
|
`window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = ${JSON.stringify(
|
|
getAppendComponentStack(),
|
|
)};
|
|
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = ${JSON.stringify(
|
|
getBreakOnConsoleErrors(),
|
|
)};
|
|
window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify(
|
|
getSavedComponentFilters(),
|
|
)};
|
|
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = ${JSON.stringify(
|
|
getShowInlineWarningsAndErrors(),
|
|
)};
|
|
window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ = ${JSON.stringify(
|
|
getHideConsoleLogsInStrictMode(),
|
|
)};
|
|
window.__REACT_DEVTOOLS_BROWSER_THEME__ = ${JSON.stringify(
|
|
getBrowserTheme(),
|
|
)};`,
|
|
);
|
|
}
|
|
|
|
export default syncSavedPreferences;
|