Skip to content

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

Merged
merged 5 commits into from
Sep 17, 2019
Merged

Core: Fix error handling #8097

merged 5 commits into from
Sep 17, 2019

Conversation

Hypnosphi
Copy link
Member

Issue: #8087

What I did

– Added a try/catch
– Added an error boundary for React

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@Hypnosphi Hypnosphi added bug react patch:yes Bugfix & documentation PR that need to be picked to main branch core labels Sep 16, 2019
@vercel
Copy link

vercel bot commented Sep 16, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-error-handling.storybook.now.sh

showMain,
showError,
forceRender,
}: RenderMainArgs) {
const element = <StoryFn />;

if (!element) {
Copy link
Member Author

@Hypnosphi Hypnosphi Sep 16, 2019

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)) {
Copy link
Member Author

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';
Copy link
Member

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?

Copy link
Member Author

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)

@Hypnosphi Hypnosphi requested a review from kazupon as a code owner September 17, 2019 02:36
@shilman shilman changed the title Fix error handling Core: Fix error handling Sep 17, 2019
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Great work @Hypnosphi! 🙇 🙇 🙇

shilman added a commit that referenced this pull request Sep 17, 2019
Core: Fix error handling
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Sep 17, 2019
@KaySackey
Copy link

@dependabot ignore this major version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch react
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants