|
|
|
@ -49,7 +49,7 @@ import {
|
|
|
|
import { Boundary } from './dom/blocks/boundary.js';
|
|
|
|
import { Boundary } from './dom/blocks/boundary.js';
|
|
|
|
import * as w from './warnings.js';
|
|
|
|
import * as w from './warnings.js';
|
|
|
|
import { is_firefox } from './dom/operations.js';
|
|
|
|
import { is_firefox } from './dom/operations.js';
|
|
|
|
import { active_fork, Fork } from './reactivity/forks.js';
|
|
|
|
import { active_fork, Fork, remove_active_fork } from './reactivity/forks.js';
|
|
|
|
import { log_effect_tree } from './dev/debug.js';
|
|
|
|
import { log_effect_tree } from './dev/debug.js';
|
|
|
|
|
|
|
|
|
|
|
|
// Used for DEV time error handling
|
|
|
|
// Used for DEV time error handling
|
|
|
|
@ -670,7 +670,7 @@ function flush_queued_root_effects() {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var revert = active_fork.apply();
|
|
|
|
var fork = active_fork;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var flush_count = 0;
|
|
|
|
var flush_count = 0;
|
|
|
|
@ -692,18 +692,19 @@ function flush_queued_root_effects() {
|
|
|
|
root.f ^= CLEAN;
|
|
|
|
root.f ^= CLEAN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
process_effects(root, active_fork);
|
|
|
|
process_effects(root, fork);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
// TODO this doesn't seem quite right — may run into
|
|
|
|
// TODO this doesn't seem quite right — may run into
|
|
|
|
// interesting cases where there are multiple roots.
|
|
|
|
// interesting cases where there are multiple roots.
|
|
|
|
// it'll do for now though
|
|
|
|
// it'll do for now though
|
|
|
|
if (active_fork.settled()) {
|
|
|
|
if (fork.settled()) {
|
|
|
|
active_fork.remove();
|
|
|
|
fork.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
revert();
|
|
|
|
remove_active_fork();
|
|
|
|
|
|
|
|
|
|
|
|
is_flushing = false;
|
|
|
|
is_flushing = false;
|
|
|
|
|
|
|
|
|
|
|
|
last_scheduled_effect = null;
|
|
|
|
last_scheduled_effect = null;
|
|
|
|
@ -787,8 +788,13 @@ export function schedule_effect(signal) {
|
|
|
|
* @param {Fork} fork
|
|
|
|
* @param {Fork} fork
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function process_effects(effect, fork) {
|
|
|
|
function process_effects(effect, fork) {
|
|
|
|
|
|
|
|
var revert = fork.apply();
|
|
|
|
|
|
|
|
|
|
|
|
var current_effect = effect.first;
|
|
|
|
var current_effect = effect.first;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Effect[]} */
|
|
|
|
|
|
|
|
var async_effects = [];
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Effect[]} */
|
|
|
|
/** @type {Effect[]} */
|
|
|
|
var render_effects = [];
|
|
|
|
var render_effects = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -807,7 +813,11 @@ function process_effects(effect, fork) {
|
|
|
|
active_fork?.skipped_effects.has(current_effect);
|
|
|
|
active_fork?.skipped_effects.has(current_effect);
|
|
|
|
|
|
|
|
|
|
|
|
if (!skip) {
|
|
|
|
if (!skip) {
|
|
|
|
if ((flags & (BLOCK_EFFECT | EFFECT_ASYNC)) !== 0) {
|
|
|
|
if ((flags & EFFECT_ASYNC) !== 0) {
|
|
|
|
|
|
|
|
if (check_dirtiness(current_effect)) {
|
|
|
|
|
|
|
|
async_effects.push(current_effect);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if ((flags & BLOCK_EFFECT) !== 0) {
|
|
|
|
if (check_dirtiness(current_effect)) {
|
|
|
|
if (check_dirtiness(current_effect)) {
|
|
|
|
update_effect(current_effect);
|
|
|
|
update_effect(current_effect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -849,10 +859,16 @@ function process_effects(effect, fork) {
|
|
|
|
current_effect = sibling;
|
|
|
|
current_effect = sibling;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fork.settled()) {
|
|
|
|
if (async_effects.length === 0 && fork.settled()) {
|
|
|
|
flush_queued_effects(render_effects);
|
|
|
|
flush_queued_effects(render_effects);
|
|
|
|
flush_queued_effects(effects);
|
|
|
|
flush_queued_effects(effects);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
revert();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const effect of async_effects) {
|
|
|
|
|
|
|
|
update_effect(effect);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|