Skip to content

fix: compatible with styled components#376

Merged
RobPruzan merged 1 commit intoaidenybai:mainfrom
tengweiherr:fix/compatible-with-styled-components-2
May 13, 2025
Merged

fix: compatible with styled components#376
RobPruzan merged 1 commit intoaidenybai:mainfrom
tengweiherr:fix/compatible-with-styled-components-2

Conversation

@tengweiherr
Copy link
Contributor

fix #355

@emotion/styled and styled-components call components with forwardRef when generating them. We weren’t retrieving the fiber type from ForwardRef correctly, as it has a different data structure compared to functional and host components

To fix it, we just need to make a one line change: use getRenderData(getType(node?.fiber)) instead of getRenderData(node?.fiber.type).

Also, I cleaned up the code a bit as I just found out that Bippy already provides getFiberId to manage uniqueId for fibers, so we don't really need to implement our own fiber identifier.

Tested on the preview link https://wys52t.csb.app mentioned in #355

demo.mov

@vercel
Copy link

vercel bot commented May 11, 2025

@tengweiherr is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/aidenybai/react-scan@376

commit: 01eadb8

@RobPruzan
Copy link
Collaborator

LGTM, nice work 🚀

@RobPruzan RobPruzan merged commit d22a224 into aidenybai:main May 13, 2025
2 of 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.

not compatible with @emotion/styled

2 participants