-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
<svelte:boundary>
renders no content if reset
is called incorrectly
#16134
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
Comments
The logic looks faulty because you call the reset function while not in the error state, though Svelte probably should also handle that differently. If you do not call the reset function in the valid state, it seems to work as expected. attr = 3 - attr;
if (reset) {
reset();
+ reset = null;
} |
The application I originally ran into this issue in does seem to use |
@swlynch99 playground should be back up -- it got nuked by the GCP outage 😬 |
It seems like the issue I was running into was that errors thrown from stores do not get handled by |
<svelte:boundary>
fails to catch exceptions after being reset<svelte:boundary>
renders no content if reset
is called incorrectly
@swlynch99 It seems that the current behavior is intended, you are calling It happens only the 3rd time you click because the 1st time you click This i what happens step by step:
NOTE: When i say "template rendering" technically i mean I don't think this is a svelte issue, instead you should not call reset synchronously right after you set the state that will trigger the error, you should call reset only asynchronously when the user clicks a button or if really needed in the |
That sounds reasonable to me. Having a warning printed to the console would have prevented me from getting confused here as well. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
If the
reset
function is called when the<svelte:boundary>
is not showing thefailed
snippet then nothing within the<svelte:boundary>
will be rendered, not the regular content nor thefailed
snippet.Original issue description
I have a component which has an inner
$derived
that occasionally throws an exception. This exception is then handled via a<svelte:boundary>
element higher up. The first time the exception is thrown it is properly caught by the boundary. However, after resetting the boundary the exception is no longer handled if thrown again. In fact, nothing gets rendered in that case, not even thefailed
snippet.Reproduction
https://svelte.dev/playground/2a0c3ca8ec4a44f396c5cc1bdd65dece?version=5.34.0
Expected behaviour: calling
reset
should be a no-op or cause the contents of the boundary to be re-rendered. Either behaviour would be fine.Logs
System Info
System: OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish) CPU: (18) x64 13th Gen Intel(R) Core(TM) i7-13700H Memory: 16.60 GB / 31.18 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 23.11.1 - /usr/bin/node Yarn: 1.22.19 - /usr/bin/yarn npm: 10.9.2 - /usr/bin/npm pnpm: 10.3.0 - /usr/bin/pnpm npmPackages: svelte: ^5.33.18 => 5.33.18
Severity
annoyance
The text was updated successfully, but these errors were encountered: