-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Core: Fix error handling #8097
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
Core: Fix error handling #8097
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-error-handling.storybook.now.sh |
showMain, | ||
showError, | ||
forceRender, | ||
}: RenderMainArgs) { | ||
const element = <StoryFn />; | ||
|
||
if (!element) { |
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 condition is never true, as <StoryFn />
is never falsy
return; | ||
} | ||
|
||
if (!isReactRenderable(element)) { |
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.
Same here
@@ -1,9 +1,7 @@ | |||
import { document } from 'global'; | |||
import React from 'react'; | |||
import React, { ErrorInfo } from 'react'; |
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.
Is this used (ErrorInfo
)? What version of react
does it mean we require?
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.
not really, forgot to remove (and didn't get caught by eslint because of https://github.com/storybookjs/storybook/pull/6621/files#diff-e4403a877d80de653400d88d85e4801aR118, cc @ndelangen)
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 work @Hypnosphi! 🙇 🙇 🙇
@dependabot ignore this major version |
Issue: #8087
What I did
– Added a try/catch
– Added an error boundary for React