File tree Expand file tree Collapse file tree 2 files changed +7
-19
lines changed
packages/svelte/src/internal/client Expand file tree Collapse file tree 2 files changed +7
-19
lines changed Original file line number Diff line number Diff line change @@ -603,11 +603,11 @@ function resume_children(effect, local) {
603
603
// effects can schedule themselves for execution
604
604
if ( ( effect . f & CLEAN ) === 0 ) {
605
605
effect . f ^= CLEAN ;
606
- }
607
-
608
- // If a dependency of this effect changed while it was paused,
609
- // schedule the effect to update
610
- if ( check_dirtiness ( effect , true ) ) {
606
+ } else {
607
+ // If a dependency of this effect changed while it was paused,
608
+ // schedule the effect to update. we don't use `check_dirtiness`
609
+ // here because we don't want to eagerly recompute a derived like
610
+ // `{# if foo}{foo.bar()}{/if}` if `foo` is now `undefined
611
611
set_signal_status ( effect , DIRTY ) ;
612
612
schedule_effect ( effect ) ;
613
613
}
Original file line number Diff line number Diff line change @@ -151,10 +151,9 @@ export function increment_write_version() {
151
151
* Determines whether a derived or effect is dirty.
152
152
* If it is MAYBE_DIRTY, will set the status to CLEAN
153
153
* @param {Reaction } reaction
154
- * @param {boolean } [resuming]
155
154
* @returns {boolean }
156
155
*/
157
- export function check_dirtiness ( reaction , resuming = false ) {
156
+ export function check_dirtiness ( reaction ) {
158
157
var flags = reaction . f ;
159
158
160
159
if ( ( flags & DIRTY ) !== 0 ) {
@@ -203,18 +202,7 @@ export function check_dirtiness(reaction, resuming = false) {
203
202
for ( i = 0 ; i < length ; i ++ ) {
204
203
dependency = dependencies [ i ] ;
205
204
206
- if ( check_dirtiness ( /** @type {Derived } */ ( dependency ) , resuming ) ) {
207
- /* Don't execute deriveds when unpausing, for example when outer resumes
208
-
209
- {#if outer}
210
- {#if inner}
211
- {inner.func()}
212
- {/if}
213
- {/if}
214
-
215
- inner might be undefined, so don't eagerly execute `inner.func()`
216
- */
217
- if ( resuming ) return true ;
205
+ if ( check_dirtiness ( /** @type {Derived } */ ( dependency ) ) ) {
218
206
update_derived ( /** @type {Derived } */ ( dependency ) ) ;
219
207
}
220
208
You can’t perform that action at this time.
0 commit comments