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

[Content]: ErrorBoundary content is incorrect #586

Open
PeterDraex opened this issue Mar 11, 2024 · 3 comments
Open

[Content]: ErrorBoundary content is incorrect #586

PeterDraex opened this issue Mar 11, 2024 · 3 comments
Assignees
Labels
improve documentation Enhance existing documentation. pending review Awaiting review by team members.

Comments

@PeterDraex
Copy link

PeterDraex commented Mar 11, 2024

📚 Subject area/topic

/concepts/control-flow/error-boundary.mdx

📋 Page(s) affected (or suggested, for new content)

https://docs.solidjs.com/concepts/control-flow/error-boundary

📋 Description of content that is out-of-date or incorrect

The docs says:

When encountering an error, this component will render a fallback UI instead of the problematic child component(s).
[...]
image

This is clearly not how ErrorBoundary works. In case of an error, it renders fallback UI instead of all child components (not just instead of problematic ones). The illustrative image should not contain the header and sidebar.

Additionally, the ErrorBoundary doesn't just catch errors from child components, but sometimes also from child elements. For example, in the following code, the error happens and is caught within the same component:

export const ThrowError = (props: { catchInside: boolean }) => {
  const [signal, setSignal] = createSignal(true);

  return (
    <ErrorBoundary fallback={'Error caught within ThrowError.tsx'}>
      {signal() && accessUndefinedVariable} // accessUndefinedVariable is caught by this component
      {accessUndefinedVariable} // accessUndefinedVariable is caught by parent component
    </ErrorBoundary>
  );
};

I actually wanted to check the docs to get clarity about when the error is caught by the same component, and when it's caught by the parent. I would appreciate if this was clarified in the docs.

Thanks for your work!

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

https://stackblitz.com/edit/solidjs-templates-trbmh2?file=src%2FApp.tsx

@PeterDraex PeterDraex added improve documentation Enhance existing documentation. pending review Awaiting review by team members. labels Mar 11, 2024
Copy link

stackblitz bot commented Mar 11, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@JasonHassold
Copy link
Contributor

@PeterDraex these are good callouts!

@LadyBluenotes happy to help with this one!

@LadyBluenotes
Copy link
Member

@JasonHassold I'm going to ask that you hold off for the time being

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improve documentation Enhance existing documentation. pending review Awaiting review by team members.
Projects
None yet
Development

No branches or pull requests

5 participants