Skip to content

fix: add a warning when the misuse of reset in an error:boundary causes an error to be thrown when flushing the boundary content #16171

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

Merged
merged 12 commits into from
Jul 17, 2025
Merged
Prev Previous commit
Next Next commit
regenerate
  • Loading branch information
Rich-Harris committed Jul 17, 2025
commit d78ab67f8527129c91a3c801f55f9b7ceb93ca3f
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ This `reset` function should only be called once. After that, it has no effect
<button onclick={reset}>reset</button>

<svelte:boundary onerror={(e, r) => (reset = r)}>
<!-- contents >
<!-- contents -->

{#snippet failed(e)}
<p>oops! {e.message}</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/messages/client-warnings/warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ This `reset` function should only be called once. After that, it has no effect
<button onclick={reset}>reset</button>

<svelte:boundary onerror={(e, r) => (reset = r)}>
<!-- contents >
<!-- contents -->

{#snippet failed(e)}
<p>oops! {e.message}</p>
Expand Down
1 change: 1 addition & 0 deletions packages/svelte/src/internal/client/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ export function svelte_boundary_reset_onerror() {
const error = new Error(`svelte_boundary_reset_onerror\nA \`<svelte:boundary>\` \`reset\` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);

error.name = 'Svelte error';

throw error;
} else {
throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy