sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
76.98k stars 4k forks source link

chore: improve SSR invalid element error message #11585

Closed trueadm closed 2 weeks ago

trueadm commented 2 weeks ago

This should make error messages for invalid elements during SSR better, as it lets you know what component the element is in. Addressing part of the problem from https://github.com/sveltejs/svelte/issues/10630. In a follow up, once I have time, it would be good to add line numbers too to the filenames.

Before Screenshot 2024-05-13 at 13 38 26

After Screenshot 2024-05-13 at 13 38 03

changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: f647f30c095acaddc386e42ef345a72b82054673

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

This PR includes changesets to release 1 package | Name | Type | | ------ | ----- | | svelte | 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

Rich-Harris commented 2 weeks ago

I didn't realise we were doing this error_on_client stuff — shouldn't we just be erroring on the server?

trueadm commented 2 weeks ago

@Rich-Harris The issue was that no one was seeing that error and if we threw an actual error than the server instance would go down and that wasn't great. Since introducing error_on_client the amount of people complaining about incorrect HTML element nesting has dropped significantly – so it's working.