Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools: fix initial host instance selection #31892

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Dec 23, 2024

Related: #31342

This fixes RDT behaviour when some DOM element was pre-selected in built-in browser's Elements panel, and then Components panel of React DevTools was opened for the first time. With this change, React DevTools will correctly display the initial state of the Components Tree with the corresponding React Element (if possible) pre-selected.

Previously, we would only subscribe listener when TreeContext is mounted, but this only happens when user opens one of React DevTools panels for the first time. With this change, we keep state inside Store, which is created when Browser DevTools are opened. Later, TreeContext will use it for initial state value.

Planned next changes:

  1. Merge inspectedElementID and selectedElementID, I have no idea why we need both.
  2. Fix issue with AutoSizer rendering a blank container.

@hoxyq hoxyq requested review from gaearon, huntie and robhogan December 23, 2024 14:25
Copy link

vercel bot commented Dec 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 23, 2024 3:13pm

@gaearon
Copy link
Collaborator

gaearon commented Dec 23, 2024

Do we know why/when this regressed?

@hoxyq
Copy link
Contributor Author

hoxyq commented Dec 23, 2024

Do we know why/when this regressed?

Probably in #27215, by looking at a difference around main.js. Looks like I've missed some code that was syncing element selection when panel was rendered for the first time.

@hoxyq
Copy link
Contributor Author

hoxyq commented Dec 23, 2024

I will double-check if we can relatively easily add some Playwright test for this feature.

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.

3 participants