From 0ebb878166bbe0e354177ae93fe730524956d9a7 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 18 Jun 2025 08:41:47 -0400 Subject: [PATCH] reset should just be a noop after the first call --- .../.generated/client-warnings.md | 26 +++++++++ .../messages/client-warnings/warnings.md | 24 +++++++++ .../internal/client/dom/blocks/boundary.js | 9 ++++ .../svelte/src/internal/client/warnings.js | 11 ++++ .../error-boundary-reset-premature/_config.js | 54 +++++-------------- 5 files changed, 82 insertions(+), 42 deletions(-) diff --git a/documentation/docs/98-reference/.generated/client-warnings.md b/documentation/docs/98-reference/.generated/client-warnings.md index e11d73e819..948f4b9b2f 100644 --- a/documentation/docs/98-reference/.generated/client-warnings.md +++ b/documentation/docs/98-reference/.generated/client-warnings.md @@ -300,6 +300,32 @@ Reactive `$state(...)` proxies and the values they proxy have different identiti To resolve this, ensure you're comparing values where both values were created with `$state(...)`, or neither were. Note that `$state.raw(...)` will _not_ create a state proxy. +### svelte_boundary_reset_noop + +``` +A `` `reset` function only resets the boundary the first time it is called +``` + +When an error occurs while rendering the contents of a [``](https://svelte.dev/docs/svelte/svelte-boundary), the `onerror` handler is called with the error plus a `reset` function that attempts to re-render the contents. + +This `reset` function should only be called once. After that, it has no effect — in a case like this, where a reference to `reset` is stored outside the boundary, clicking the button while `` is rendered will _not_ cause the contents to be rendered again. + +```svelte + + + + + (reset = r)}> +