Skip to content

Commit

Permalink
Update RDT fork for 2024-07 (#10592)
Browse files Browse the repository at this point in the history
* Update RDT fork for 2024-07

* Fix broken string replacement for RDT injection
  • Loading branch information
markerikson authored Jul 2, 2024
1 parent 35478c6 commit 06b89f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ function installReactDevToolsIntoPause() {
const injectGlobalHookSource = require("./installHook.raw.js").default;
const reactDevtoolsBackendSource = require("./react_devtools_backend.raw.js").default;

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

export const reactDevToolsInjectionCache: Cache<
[replayClient: ReplayClientInterface, pauseId: PauseId],
Expand Down

Large diffs are not rendered by default.

0 comments on commit 06b89f4

Please sign in to comment.