Skip to content

Commit 06b89f4

Browse files
authored
Update RDT fork for 2024-07 (#10592)
* Update RDT fork for 2024-07 * Fix broken string replacement for RDT injection
1 parent 35478c6 commit 06b89f4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/ui/components/SecondaryToolbox/react-devtools/injectReactDevtoolsBackend.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ function installReactDevToolsIntoPause() {
125125
const injectGlobalHookSource = require("./installHook.raw.js").default;
126126
const reactDevtoolsBackendSource = require("./react_devtools_backend.raw.js").default;
127127

128+
// Use function replacer syntax to avoid accidentally replacing special
129+
// characters like `$&`, which could show up in the bundle source
130+
// if the minifier renames things in an annoyingly specific way
131+
// (such as `c === $ && x` becoming `c===$&&x`)
128132
const rdtInjectionExpression = `(${installReactDevToolsIntoPause})()`
129-
.replace("INSTALL_HOOK_PLACEHOLDER", `(${injectGlobalHookSource})`)
130-
.replace("DEVTOOLS_PLACEHOLDER", `(${reactDevtoolsBackendSource})`);
133+
.replace("INSTALL_HOOK_PLACEHOLDER", () => `(${injectGlobalHookSource})`)
134+
.replace("DEVTOOLS_PLACEHOLDER", () => `(${reactDevtoolsBackendSource})`);
131135

132136
export const reactDevToolsInjectionCache: Cache<
133137
[replayClient: ReplayClientInterface, pauseId: PauseId],

src/ui/components/SecondaryToolbox/react-devtools/react_devtools_backend.raw.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)