-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add React Developer Tools hook #104
Add React Developer Tools hook #104
Conversation
bd30f0f
to
9ae56d6
Compare
@@ -3,6 +3,11 @@ export default function (headHtml) { | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<script> | |||
if (window.parent !== window) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might actually throw an exception if the parent isn't same-origin - can you test it on a cross-origin page first? you may need to add a try/catch, or some other check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can safely assume this will always be served from the same origin and the storybook, and we don't need to worry about that. In fact, we can also remove the window.parent !== window
check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this could be completely omitted and instead added to the head.html
by Storybook users as needed as described here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should really be default behaviour: As React developers we expect the dev tools to "just work".
@wyattdanger Thank for doing the PR; saved me a job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wyattdanger yes, we can do it with the head.html
. As @rogchap said, this should be the default.
I think this is great. We'll take this in. |
Added a View wrapper with a key prop
Install addon as devDependency in Readme
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 9ae56d6. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
Adds a hook to make Storybook play nicely with React Developer Tools.
Fixes #102