solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

fix: add error boundary to catch invalid code within the document code

Open LukasGerm opened this issue 1 year ago • 1 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [ ] Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [ ] infrastructure changes
  • [ ] Other... Please describe:

What is the current behavior?

https://github.com/nksaraf/vinxi/issues/119

If you add gibberish code to your entry-server.tsx within the document property, the server will crash and you need to manually start it again.

What is the new behavior?

The server will error but not crash. You can fix the issue with your code and just reload your browser.

Other information

nothing to add

LukasGerm avatar May 22 '24 19:05 LukasGerm

🦋 Changeset detected

Latest commit: 21af1e2bf499d41d7fa7ffd65fb9cd13ca92c0c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 22 '24 19:05 changeset-bot[bot]

I think this is the best we have right now. Funny thing is it adds comments around the HTML document which I don't think has any issues but it isn't how I ever expected this to work.

ryansolid avatar May 28 '24 22:05 ryansolid

@ryansolid Yeah I was not able to get a better working solution at the time. 😄 I mean, if its an issue, we can probably iterate.

LukasGerm avatar May 29 '24 05:05 LukasGerm

No it isn't easy to do. I have an idea of a solution but I basically need to remake a limited version of the errorboundary from scratch..

ryansolid avatar May 29 '24 21:05 ryansolid

Looking closer I see this solution doesn't actually show the error but makes the dev server not crash. Let me see if we can do more here.

ryansolid avatar May 29 '24 22:05 ryansolid