pull/16150/head
Rich Harris 3 months ago
parent fa97c56aca
commit 27fe22bf5c

@ -603,11 +603,11 @@ function resume_children(effect, local) {
// effects can schedule themselves for execution
if ((effect.f & CLEAN) === 0) {
effect.f ^= CLEAN;
}
// If a dependency of this effect changed while it was paused,
// schedule the effect to update
if (check_dirtiness(effect, true)) {
} else {
// If a dependency of this effect changed while it was paused,
// schedule the effect to update. we don't use `check_dirtiness`
// here because we don't want to eagerly recompute a derived like
// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined
set_signal_status(effect, DIRTY);
schedule_effect(effect);
}

@ -151,10 +151,9 @@ export function increment_write_version() {
* Determines whether a derived or effect is dirty.
* If it is MAYBE_DIRTY, will set the status to CLEAN
* @param {Reaction} reaction
* @param {boolean} [resuming]
* @returns {boolean}
*/
export function check_dirtiness(reaction, resuming = false) {
export function check_dirtiness(reaction) {
var flags = reaction.f;
if ((flags & DIRTY) !== 0) {
@ -203,18 +202,7 @@ export function check_dirtiness(reaction, resuming = false) {
for (i = 0; i < length; i++) {
dependency = dependencies[i];
if (check_dirtiness(/** @type {Derived} */ (dependency), resuming)) {
/* Don't execute deriveds when unpausing, for example when outer resumes
{#if outer}
{#if inner}
{inner.func()}
{/if}
{/if}
inner might be undefined, so don't eagerly execute `inner.func()`
*/
if (resuming) return true;
if (check_dirtiness(/** @type {Derived} */ (dependency))) {
update_derived(/** @type {Derived} */ (dependency));
}

Loading…
Cancel
Save