-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enable strict mode in storybook on a per story basis #3333
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
Conversation
.storybook/strictmode.js
Outdated
<Checkbox | ||
marginTop={10} | ||
isSelected={selected} | ||
onChange={() => setSelected(selected => !selected)}> | ||
Toggle strict mode | ||
</Checkbox> |
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.
TODO: still trying to figure out if it is possible to have this be a option in the controls
panel instead
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.
Can't put it there, but you could put it up in the toolbar across the top of the stories, where we put the locale/scale/theme
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.
urgh, I was hoping that https://storybook.js.org/docs/react/essentials/controls#parameters was alluding to being able to set a control param globally but putting it in the toolbar sounds good as well
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.
you probably could through a decorator but I think it'd be a lot more work than it's worth, plus you'd have to apply it to every component, there's a number of them with no controls
I think toolbar is the better solution
Build successful! 🎉 |
Build successful! 🎉 |
the globals are updating anymore for some reason...
let updateStrict = (val) => { | ||
setStrict(val); | ||
}; | ||
channel.on('strict/updated', updateStrict); |
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 would've like to used the storybook globals but for some reason it stopped working
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.
Well, the storybook seems to be running just fine. This is somewhat problematic for me though, since I can't seem to do anything that gives a StrictMode error. Have you been able to see any?
A good candidate is ComboBox (or anything that uses a overlay I believe). |
o, I figured it out, can't test it in storybook built by CI, that's production.... haha, have to do it locally |
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.
Tested locally, LGTM.
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.
Great, I can see NumberField not working when strict mode is on and it works when strict mode is off.
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: