File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
packages/svelte/src/internal/client/reactivity Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -126,9 +126,11 @@ export function async_derived(fn, location) {
126126 try {
127127 // If this code is changed at some point, make sure to still access the then property
128128 // of fn() to read any signals it might access, so that we track them as dependencies.
129+ // We call `unset_context` to undo any `save` calls that happen inside `fn()`
129130 Promise . resolve ( fn ( ) ) . then ( d . resolve , d . reject ) . then ( unset_context ) ;
130131 } catch ( error ) {
131132 d . reject ( error ) ;
133+ unset_context ( ) ;
132134 }
133135
134136 if ( DEV ) current_async_effect = null ;
@@ -185,8 +187,6 @@ export function async_derived(fn, location) {
185187 boundary . update_pending_count ( - 1 ) ;
186188 if ( ! pending ) batch . decrement ( ) ;
187189 }
188-
189- unset_context ( ) ;
190190 } ;
191191
192192 d . promise . then ( handler , ( e ) => handler ( null , e || 'unknown' ) ) ;
You can’t perform that action at this time.
0 commit comments