pull/10958/head
Dominic Gannaway 6 months ago
commit 8150fcccf2

@ -39,9 +39,10 @@ import { remove } from '../dom/reconciler.js';
* @returns {import('#client').Effect}
*/
function create_effect(type, fn, sync, init = true) {
var is_root = (type & ROOT_EFFECT) !== 0;
/** @type {import('#client').Effect} */
const effect = {
parent: current_effect,
var effect = {
parent: is_root ? null : current_effect,
dom: null,
deps: null,
f: type | DIRTY,
@ -63,7 +64,7 @@ function create_effect(type, fn, sync, init = true) {
if (init) {
if (sync) {
const previously_flushing_effect = is_flushing_effect;
var previously_flushing_effect = is_flushing_effect;
try {
set_is_flushing_effect(true);

@ -358,12 +358,7 @@ export function remove_reactions(signal, start_index) {
export function destroy_children(signal) {
if (signal.effects) {
for (var i = 0; i < signal.effects.length; i += 1) {
var effect = signal.effects[i];
// TODO ideally root effects would be parentless
if ((effect.f & ROOT_EFFECT) === 0) {
destroy_effect(effect);
}
destroy_effect(signal.effects[i]);
}
signal.effects = null;
}

Loading…
Cancel
Save