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

[Bug]: Component on Docs page doesn't recover from error #30319

Open
valentinpalkovic opened this issue Jan 21, 2025 · 1 comment
Open

[Bug]: Component on Docs page doesn't recover from error #30319

valentinpalkovic opened this issue Jan 21, 2025 · 1 comment

Comments

@valentinpalkovic
Copy link
Contributor

Describe the bug

When visiting a docs page and changing a story so that it throws an error, the docs page successfully shows the error. Reverting the change and make the story render successfully doesn't lead to a recovered docs page. The docs page remains in an error state.

Reproduction link

Reproduction steps

  1. Checkout Mealdrop
  2. Start Storybook
  3. Go to http://localhost:6006/?path=/docs/components-button--docs
  4. Edit src/components/Button/Button.tsx -> Add a useEffect and throw an error inside it
  5. Go to the browser, component successfully crashes
  6. Revert the change
  7. Go to the browser -> component doesn’t recover. It remains in an error state

System

-

Additional context

No response

Copy link
Contributor

greptile-apps bot commented Jan 21, 2025

** Disclaimer** This information might be inaccurate, due to it being generated automatically
This is likely related to error boundary handling in the docs page. The fix would involve: 1. Modify code/ui/components/preview/Preview.tsx to ensure the error boundary resets when the story content changes 2. Add a key prop to the error boundary component that changes when the story updates: tsx // In Preview.tsx <ErrorBoundary key={storyId || previewId}> {/* story content */} </ErrorBoundary> This will force the error boundary to remount when the story changes, allowing recovery from errors.

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Edit Issue Bot Settings · Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant