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

feat(react): react devtool #236

Merged
merged 11 commits into from
Dec 9, 2021
Merged

feat(react): react devtool #236

merged 11 commits into from
Dec 9, 2021

Conversation

danilowoz
Copy link
Member

@danilowoz danilowoz commented Dec 3, 2021

This introduces support for React debugging, which allows you to inspect the React component hierarchies in the iframe. This is useful for props debugging and understanding the component tree.

Screenshot 2021-12-03 at 19 20 23

Depends on codesandbox/codesandbox-client#6337

@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 3, 2021 18:25 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 3, 2021 19:22 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 3, 2021 19:22 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 3, 2021 19:22 Inactive
@danilowoz
Copy link
Member Author

danilowoz commented Dec 3, 2021

@bvaughn, I've made some progress 😄

@codesandbox codesandbox deleted a comment from vercel bot Dec 3, 2021
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 3, 2021 19:27 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 3, 2021 19:27 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 3, 2021 19:27 Inactive
@codesandbox codesandbox deleted a comment from vercel bot Dec 3, 2021
@bvaughn
Copy link

bvaughn commented Dec 3, 2021

Ooh this is exciting! Eager to see this when it's done!

@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 4, 2021 11:38 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 4, 2021 11:38 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 4, 2021 11:38 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 09:22 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 09:22 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 09:22 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 10:26 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 10:26 Inactive
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 8, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6e49c03:

Sandbox Source
Sandpack Blog Example 1 Configuration

@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 10:47 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 10:47 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 10:47 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 11:46 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 11:46 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 11:46 Inactive
@bvaughn
Copy link

bvaughn commented Dec 8, 2021

@danilowoz Exciting to see so many updates! Let me know when it's ready for a test drive.

@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 19:30 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 19:30 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 19:31 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 19:54 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 19:54 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 19:54 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 8, 2021 19:59 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 8, 2021 19:59 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 8, 2021 20:00 Inactive
## UnstyledOpenInCodeSandboxButton & OpenInCodeSandboxButton
## ReactDevTools

Sandpack also provides a component to add a plugin for React debugging, which allows you to inspect the React component hierarchies in the iframe. This is useful for `props` debugging and understanding the component tree.
Copy link
Contributor

@sannek sannek Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sandpack also provides a component to add a plugin for React debugging, which allows you to inspect the React component hierarchies in the iframe. This is useful for `props` debugging and understanding the component tree.
Sandpack also provides a component that adds React DevTools, allowing you to inspect the React component hierarchies in the iframe. This is useful for `props` debugging and understanding the component tree. Our `SandpackReactDevTools` component has the same functionality as the React DevTools brower extensions, but it only shows what is in your Sandpack instance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm not 100% sure if "instance" is the right word there at the end??)

@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 9, 2021 14:45 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 9, 2021 14:45 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 9, 2021 14:45 Inactive
}) => {
const { sandpack } = useSandpack();
const c = useClasser("sp");

return (
<SandpackThemeProvider theme={theme}>
<div ref={sandpack.lazyAnchorRef} className={c("layout")}>
<div ref={sandpack.lazyAnchorRef} className={c("layout")} style={style}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get why this was added? is there an instance of the Layout getting inline styles?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a way to override styles in the component level easily, so I realized it was not passing the style props down to the component. I think we could just spread all props into the component and not only explicit pass style, it seems cleaver.

@vercel vercel bot temporarily deployed to Preview – sandpack-docs December 9, 2021 15:46 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-landing December 9, 2021 15:46 Inactive
@vercel vercel bot temporarily deployed to Preview – sandpack-theme December 9, 2021 15:46 Inactive
@danilowoz danilowoz merged commit a67e1b2 into main Dec 9, 2021
@danilowoz danilowoz deleted the feat/react-devtool branch December 9, 2021 15:56
</SandpackLayout>
</SandpackProvider>
)
}`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you forgot the "```" ticks for formatting here.

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.

4 participants