Skip to content

Commit 9d72644

Browse files
committed
Initialize backend/frontend early in devtools shell so settings are synced during initial render
1 parent 1ccd5b9 commit 9d72644

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/react-devtools-shell/src/devtools.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ const {contentDocument, contentWindow} = iframe;
1717
// Helps with positioning Overlay UI.
1818
contentWindow.__REACT_DEVTOOLS_TARGET_WINDOW__ = window;
1919

20+
// Initialize the backend and frontend early so that we have the messages that we
21+
// need during initial render
2022
initializeBackend(contentWindow);
2123

24+
// Activate the backend only once the DevTools frontend Store has been initialized.
25+
// Otherwise the Store may miss important initial tree op codes.
26+
// activateBackend(contentWindow);
27+
const DevTools = initializeFrontend(contentWindow);
28+
29+
activateBackend(contentWindow);
30+
2231
const container = ((document.getElementById('devtools'): any): HTMLElement);
2332

2433
let isTestAppMounted = true;
@@ -45,12 +54,6 @@ mountButton.addEventListener('click', function() {
4554
inject('dist/app.js', () => {
4655
initDevTools({
4756
connect(cb) {
48-
const DevTools = initializeFrontend(contentWindow);
49-
50-
// Activate the backend only once the DevTools frontend Store has been initialized.
51-
// Otherwise the Store may miss important initial tree op codes.
52-
activateBackend(contentWindow);
53-
5457
const root = createRoot(container);
5558
root.render(
5659
createElement(DevTools, {

0 commit comments

Comments
 (0)