Visitar URL original
feat(inspector): add interactive element inspector and cross-panel component funnel by Xoppyc · Pull Request #34 · solidjs/solid-start-devtools · GitHub
Skip to content

feat(inspector): add interactive element inspector and cross-panel component funnel - #34

Merged
lxsmnsyc merged 12 commits into
solidjs:mainfrom
Xoppyc:feat/inspector-mode
Oct 29, 2026
Merged

lxsmnsyc merged 12 commits into
solidjs:mainfrom
Xoppyc:feat/inspector-mode

Conversation

@Xoppyc

@Xoppyc Xoppyc commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an interactive Element Inspector and cross-panel component funneling to the devtools dock.

Rather than only serving as a jump-to-editor utility, selecting an element activates a component funnel across the devtools panels:

  1. Reactivity Graph: Isolates reactive signals, memos, and effects belonging to the selected component's owner instance hierarchy (instead of showing all global reactive nodes or broad name matches).
  2. Ownership Tree: Automatically expands, reveals, and scrolls to the selected component node so its props and internal scopes can be inspected immediately.
  3. Preserves Active Tab: Selecting an element keeps you on your current active panel (e.g. Reactivity) without jarring tab jumps, while displaying a funnel badge in the dock header.
  4. Dock Header Funnel Badge: Shows the component name with a quick jump to the Ownership tree, a direct "See in editor" button (using Vite's /__open-in-editor), and a clear button (✕) to unfunnel.
  5. Shortcuts & Activation:
    • Alt+Shift+C (or the crosshair icon in the dock header) toggles inspect mode.
    • Hovering DOM nodes displays an overlay badge with component name, file location, and dimensions.
    • Escape cancels inspection.

Technical Details

  • Zero Additional Plugins: Relies exclusively on @solidjs/vite-plugin's dev-mode location injection (owner._component.fn.location) and Solid's runtime ownership tree.
  • Robust DOM Lookup: Monkeypatches document.createElement / createElementNS in dev mode using a WeakMap<Node, Owner> to map real DOM nodes back to their originating Solid component owners without adding data-attributes to the user's DOM.
  • Instance-Level Reactivity Filtering: ReactivityViewer filters nodes using isDescendantOf(node.owner, targetOwner) so multiple instances of identical components (like <For> iterations or reused UI components) are isolated accurately.
  • Editor Launch Reliability: Handles nested monorepo / example subpath depths against Vite's launch-editor-middleware.

Showcase

2026-10-26-12:34:54 380697851

Verification

  • Unit tests added for DOM-to-component lookup and traversal (src/dev-toolbar/inspector/lookup.test.ts).
  • pnpm test (all 116 tests passing).
  • pnpm typecheck (clean TypeScript check).
  • pnpm format:check (oxfmt clean).
  • pnpm build (clean rolldown bundle & DTS generation).
  • Changeset included (.changeset/element-inspector.md).

lxsmnsyc and others added 11 commits October 23, 2026 15:19
- The toolbar opens as a full-width dock at the bottom of the page. Its top edge can be dragged to change its height, and the page can scroll past it.
- Closed, the dock is a small grip at the bottom center. It grows into a pull tab on hover or focus and turns red when there are errors. A click or a drag up opens the dock.
- Alt+Shift+D opens and closes the dock.
- A side nav holds the tabs, with counts of errors and calls. The header shows the version and the current route.
- The dock keeps its open state, tab and height across reloads.
- Selected rows and tabs use a rounded fill instead of a colored left border. Graph nodes show their kind with a dot and a tint.
- The error code view scrolls to the frame inside the dock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve conflicts with the dock (solidjs#26), agent reports (solidjs#27) and highlight
updates (solidjs#38). Alt+Shift+C now skips repeat keys and editable targets like
the other shortcuts. The hover lookup runs only when the pointer moves onto
another element, since it walks the whole ownership tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lxsmnsyc
lxsmnsyc changed the base branch from feat/devtools-dock to main October 29, 2026 07:07
@lxsmnsyc

Copy link
Copy Markdown
Member

I changed the base to main, since feat/devtools-dock was merged as #26, and pushed one merge commit to this branch: 8c2ccbd.

Conflicts resolved, keeping both sides:

Two small changes in the same commit:

  • Alt+Shift+C now skips repeat keys and focused text fields, as Alt+Shift+D and Alt+Shift+H do. Before, it toggled inspect mode while typing in an input.
  • In inspector/overlay.tsx, the pointermove handler returns early when the element under the pointer has not changed. findComponentFromElement takes two full ownership tree snapshots, and it ran on every pointermove.

Not changed, for a follow-up:

  • openInEditor sends one request for every trailing part of the path. If more than one of those paths exists under the Vite root, more than one file opens. This also applies to the existing button in the Ownership panel.
  • componentFilter on ReactivityViewer is never used: ownerFilter is always passed with it and takes priority.

Checks after the merge: build, 149 unit tests, typecheck, format, publint/attw and 15 e2e tests pass locally.

@lxsmnsyc
lxsmnsyc merged commit 47f4e1e into solidjs:main Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants