Skip to content

feat(react): capture runtime props without wrapping user components#1

Open
yann-copilot wants to merge 4 commits intostorybookjs:mainfrom
yann-copilot:feat/react-runtime-props-no-wrapper
Open

feat(react): capture runtime props without wrapping user components#1
yann-copilot wants to merge 4 commits intostorybookjs:mainfrom
yann-copilot:feat/react-runtime-props-no-wrapper

Conversation

@yann-copilot
Copy link
Contributor

@yann-copilot yann-copilot commented Feb 28, 2026

Summary

This proposes a React-only alternative that captures runtime props without transforming user component declarations into wrappers.

What changed

  • src/frameworks/react/transform.ts

    • stop wrapping components with withComponentHighlighter(...)
    • only inject side-effect runtime import (virtual:component-highlighter/runtime) for React files with JSX
  • src/frameworks/react/runtime-module.ts

    • add fiber-tree scanner that discovers composite component fibers
    • read memoizedProps and resolve nearest host element
    • emit existing register/update/unregister events so current overlay/listener pipeline keeps working

Why

Current implementation mutates user source shape by adding wrappers, which is intrusive and can affect debugging/tooling expectations.

This keeps original component structure intact while still collecting runtime props for the highlighter/story generation workflow.

Scope

  • React only
  • dev/runtime behavior only

Caveats

  • relies on React internals (__reactContainer$ / __reactFiber$ and fiber shape), so this is intentionally experimental and may require maintenance across React updates.

@yann-copilot yann-copilot force-pushed the feat/react-runtime-props-no-wrapper branch from ea8ddde to c1227b5 Compare March 1, 2026 11:56
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/yannbf/vite-plugin-experimental-storybook-devtools@1

commit: 410ec8e

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