Skip to content

fix[dynamic-scripts-injection]: unregister content scripts before registration#26765

Merged
hoxyq merged 1 commit intofacebook:mainfrom
hoxyq:devtools/fixed-dynamic-scripts-double-injection
May 3, 2023
Merged

fix[dynamic-scripts-injection]: unregister content scripts before registration#26765
hoxyq merged 1 commit intofacebook:mainfrom
hoxyq:devtools/fixed-dynamic-scripts-double-injection

Conversation

@hoxyq
Copy link
Copy Markdown
Contributor

@hoxyq hoxyq commented May 3, 2023

Summary

Fixes #26756.

DevTools is failing to inject __REACT_DEVTOOLS_GLOBAL_HOOK__ hook in incognito mode. This is not happening straight-forward, but if extension is toggled on and off, the next time I try to open it I am receiving an error that content script was already registered.

Screenshot 2023-05-02 at 14 36 53

  • Unregistering content scripts before attempting to register them again. We need to inject __REACT_DEVTOOLS_GLOBAL_HOOK__ on each page, so this should be expected behaviour.
  • Fixed error logging

How did you test this change?

Local build of extension for Chrome, trying the same steps, which resulted in an error.
No regression in performance, tested on react.dev, still the same.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevTools Bug]: React pages not being detected as using React in Incognito mode

3 participants