You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor[devtools/extension]: migrate from using setInterval for polling if react is loaded (#27323)
`chrome.devtools.inspectedWindow.eval` is asynchronous, so using it in
`setInterval` is a mistake.
Sometimes this results into mounting React DevTools twice, and user sees
errors about duplicated fibers in store.
With these changes, `executeIfReactHasLoaded` executed recursively with
a threshold (in case if page doesn't have react).
Although we minimize the risk of mounting DevTools twice here, this
approach is not the best way to have this problem solved. Dumping some
thoughts and ideas that I've tried, but which are out of the scope for
this release, because they can be too risky and time-consuming.
Potential changes:
- Have 2 content scripts:
- One `prepareInjection` to notify service worker on renderer attached
- One which runs on `document_idle` to finalize check, in case if there
is no react
- Service worker will notify devtools page that it is ready to mount
React DevTools panels or should show that there is no React to be found
- Extension port from devtools page should be persistent and connected
when `main.js` is executed
- Might require refactoring the logic of how we connect devtools and
proxy ports
Some corner cases:
- Navigating to restricted pages, like `chrome://<something>` and back
- When react is lazily loaded, like in an attached iframe, or just
opened modal
- In-tab navigation with pre-cached pages, I think only Chrome does it
- Firefox is still on manifest v2 and it doesn't allow running content
scripts in ExecutionWorld.MAIN, so it requires a different approach
DiffTrain build for commit 9b4f847.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23994,7 +23994,7 @@ function createFiberRoot(
23994
23994
return root;
23995
23995
}
23996
23996
23997
-
var ReactVersion = "18.3.0-canary-7022e8d6a-20230831";
23997
+
var ReactVersion = "18.3.0-canary-9b4f847d9-20230901";
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8617,7 +8617,7 @@ var devToolsConfig$jscomp$inline_1027 = {
8617
8617
throwError("TestRenderer does not support findFiberByHostInstance()");
8618
8618
},
8619
8619
bundleType: 0,
8620
-
version: "18.3.0-canary-7022e8d6a-20230831",
8620
+
version: "18.3.0-canary-9b4f847d9-20230901",
8621
8621
rendererPackageName: "react-test-renderer"
8622
8622
};
8623
8623
varinternals$jscomp$inline_1226={
@@ -8648,7 +8648,7 @@ var internals$jscomp$inline_1226 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9043,7 +9043,7 @@ var devToolsConfig$jscomp$inline_1069 = {
9043
9043
throwError("TestRenderer does not support findFiberByHostInstance()");
9044
9044
},
9045
9045
bundleType: 0,
9046
-
version: "18.3.0-canary-7022e8d6a-20230831",
9046
+
version: "18.3.0-canary-9b4f847d9-20230901",
9047
9047
rendererPackageName: "react-test-renderer"
9048
9048
};
9049
9049
varinternals$jscomp$inline_1267={
@@ -9074,7 +9074,7 @@ var internals$jscomp$inline_1267 = {
0 commit comments