fix(example): remove unnecessary Vite workarounds#7
Conversation
The Vite hook deletion, manual WebSocket awaiting, and dynamic imports were not needed — the connection issues were caused by a separate bug. Simplify to the straightforward initialize() + connectToDevTools() flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08faebb9b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch { | ||
| // ignore — property may be non-configurable (browser extension) | ||
| } | ||
| import { createRoot } from 'react-dom/client'; |
There was a problem hiding this comment.
Initialize DevTools hook before importing react-dom
react-dom/client is imported before initialize() runs, and ES module dependencies execute before top-level statements. That means ReactDOM can attempt DevTools injection before the standalone hook exists; in contexts without a preinstalled hook (for example, production builds or entrypoints without React Refresh), the renderer is never registered and connectToDevTools() cannot populate the tree. This ordering regression is introduced by switching from dynamic imports to the static react-dom/client import.
Useful? React with 👍 / 👎.
Summary
__REACT_DEVTOOLS_GLOBAL_HOOK__deletion hackinitialize()+connectToDevTools()flowThe workarounds were not needed — the connection issues were caused by a separate bug.
Test plan
npx viteand verify devtools connects🤖 Generated with Claude Code