|
|
@ -22,8 +22,7 @@ import {
|
|
|
|
BLOCK_EFFECT,
|
|
|
|
BLOCK_EFFECT,
|
|
|
|
ROOT_EFFECT,
|
|
|
|
ROOT_EFFECT,
|
|
|
|
LEGACY_DERIVED_PROP,
|
|
|
|
LEGACY_DERIVED_PROP,
|
|
|
|
DISCONNECTED,
|
|
|
|
DISCONNECTED
|
|
|
|
EFFECT_QUEUED
|
|
|
|
|
|
|
|
} from './constants.js';
|
|
|
|
} from './constants.js';
|
|
|
|
import { flush_tasks } from './dom/task.js';
|
|
|
|
import { flush_tasks } from './dom/task.js';
|
|
|
|
import { add_owner } from './dev/ownership.js';
|
|
|
|
import { add_owner } from './dev/ownership.js';
|
|
|
@ -512,8 +511,8 @@ function flush_queued_root_effects(root_effects) {
|
|
|
|
for (var i = 0; i < length; i++) {
|
|
|
|
for (var i = 0; i < length; i++) {
|
|
|
|
var effect = root_effects[i];
|
|
|
|
var effect = root_effects[i];
|
|
|
|
|
|
|
|
|
|
|
|
if ((effect.f & EFFECT_QUEUED) !== 0) {
|
|
|
|
if ((effect.f & CLEAN) === 0) {
|
|
|
|
effect.f ^= EFFECT_QUEUED;
|
|
|
|
effect.f ^= CLEAN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Effect[]} */
|
|
|
|
/** @type {Effect[]} */
|
|
|
@ -593,15 +592,10 @@ export function schedule_effect(signal) {
|
|
|
|
effect = effect.parent;
|
|
|
|
effect = effect.parent;
|
|
|
|
var flags = effect.f;
|
|
|
|
var flags = effect.f;
|
|
|
|
|
|
|
|
|
|
|
|
if ((flags & BRANCH_EFFECT) !== 0) {
|
|
|
|
if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
|
|
if ((flags & CLEAN) === 0) return;
|
|
|
|
if ((flags & CLEAN) === 0) return;
|
|
|
|
effect.f ^= CLEAN;
|
|
|
|
effect.f ^= CLEAN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((flags & ROOT_EFFECT) !== 0) {
|
|
|
|
|
|
|
|
if ((flags & EFFECT_QUEUED) !== 0) return;
|
|
|
|
|
|
|
|
effect.f ^= EFFECT_QUEUED;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
queued_root_effects.push(effect);
|
|
|
|
queued_root_effects.push(effect);
|
|
|
@ -624,23 +618,18 @@ function process_effects(effect, collected_effects) {
|
|
|
|
|
|
|
|
|
|
|
|
main_loop: while (current_effect !== null) {
|
|
|
|
main_loop: while (current_effect !== null) {
|
|
|
|
var flags = current_effect.f;
|
|
|
|
var flags = current_effect.f;
|
|
|
|
var is_active = (flags & INERT) === 0;
|
|
|
|
|
|
|
|
var is_branch = (flags & BRANCH_EFFECT) !== 0;
|
|
|
|
var is_branch = (flags & BRANCH_EFFECT) !== 0;
|
|
|
|
var is_clean = (flags & CLEAN) !== 0;
|
|
|
|
var is_skippable_branch = is_branch && (flags & CLEAN) !== 0;
|
|
|
|
var child = current_effect.first;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Skip this branch if it's clean
|
|
|
|
|
|
|
|
if (is_active && (!is_branch || !is_clean)) {
|
|
|
|
|
|
|
|
if (is_branch) {
|
|
|
|
|
|
|
|
set_signal_status(current_effect, CLEAN);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_skippable_branch && (flags & INERT) === 0) {
|
|
|
|
if ((flags & RENDER_EFFECT) !== 0) {
|
|
|
|
if ((flags & RENDER_EFFECT) !== 0) {
|
|
|
|
if (!is_branch && check_dirtiness(current_effect)) {
|
|
|
|
if (is_branch) {
|
|
|
|
|
|
|
|
current_effect.f ^= CLEAN;
|
|
|
|
|
|
|
|
} else if (check_dirtiness(current_effect)) {
|
|
|
|
update_effect(current_effect);
|
|
|
|
update_effect(current_effect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Child might have been mutated since running the effect or checking dirtiness
|
|
|
|
|
|
|
|
child = current_effect.first;
|
|
|
|
var child = current_effect.first;
|
|
|
|
|
|
|
|
|
|
|
|
if (child !== null) {
|
|
|
|
if (child !== null) {
|
|
|
|
current_effect = child;
|
|
|
|
current_effect = child;
|
|
|
|