pull/16150/head
Matei-Paul Trandafir 3 months ago
parent 373ca3faef
commit a5c671094f
No known key found for this signature in database
GPG Key ID: BC96CA77836E14F8

@ -21,7 +21,6 @@ export const INSPECT_EFFECT = 1 << 18;
export const HEAD_EFFECT = 1 << 19; export const HEAD_EFFECT = 1 << 19;
export const EFFECT_HAS_DERIVED = 1 << 20; export const EFFECT_HAS_DERIVED = 1 << 20;
export const EFFECT_IS_UPDATING = 1 << 21; export const EFFECT_IS_UPDATING = 1 << 21;
export const TEMPLATE_EFFECT = 1 << 22;
export const STATE_SYMBOL = Symbol('$state'); export const STATE_SYMBOL = Symbol('$state');
export const LEGACY_PROPS = Symbol('legacy props'); export const LEGACY_PROPS = Symbol('legacy props');

@ -32,8 +32,7 @@ import {
HEAD_EFFECT, HEAD_EFFECT,
MAYBE_DIRTY, MAYBE_DIRTY,
EFFECT_HAS_DERIVED, EFFECT_HAS_DERIVED,
BOUNDARY_EFFECT, BOUNDARY_EFFECT
TEMPLATE_EFFECT
} from '#client/constants'; } from '#client/constants';
import { set } from './sources.js'; import { set } from './sources.js';
import * as e from '../errors.js'; import * as e from '../errors.js';
@ -345,12 +344,12 @@ export function template_effect(fn, thunks = [], d = derived) {
define_property(inner, 'name', { value: '{expression}' }); define_property(inner, 'name', { value: '{expression}' });
const deriveds = thunks.map(d); const deriveds = thunks.map(d);
block(inner, TEMPLATE_EFFECT); block(inner);
}); });
} }
const deriveds = thunks.map(d); const deriveds = thunks.map(d);
return block(() => fn(...deriveds.map(get)), TEMPLATE_EFFECT); return block(() => fn(...deriveds.map(get)));
} }
/** /**

@ -22,8 +22,7 @@ import {
ROOT_EFFECT, ROOT_EFFECT,
LEGACY_DERIVED_PROP, LEGACY_DERIVED_PROP,
DISCONNECTED, DISCONNECTED,
EFFECT_IS_UPDATING, EFFECT_IS_UPDATING
TEMPLATE_EFFECT
} from './constants.js'; } from './constants.js';
import { flush_tasks } from './dom/task.js'; import { flush_tasks } from './dom/task.js';
import { internal_set, old_values } from './reactivity/sources.js'; import { internal_set, old_values } from './reactivity/sources.js';
@ -204,8 +203,8 @@ export function check_dirtiness(reaction, resuming = false) {
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
dependency = dependencies[i]; dependency = dependencies[i];
if (check_dirtiness(/** @type {Derived} */ (dependency))) { if (check_dirtiness(/** @type {Derived} */ (dependency), resuming)) {
/* Don't execute deriveds of template effects when unpausing, for example when outer resumes /* Don't execute deriveds when unpausing, for example when outer resumes
{#if outer} {#if outer}
{#if inner} {#if inner}
@ -215,7 +214,7 @@ export function check_dirtiness(reaction, resuming = false) {
inner might be undefined, so don't eagerly execute `inner.func()` inner might be undefined, so don't eagerly execute `inner.func()`
*/ */
if (resuming && (reaction.f & TEMPLATE_EFFECT) !== 0) return true; if (resuming) return true;
update_derived(/** @type {Derived} */ (dependency)); update_derived(/** @type {Derived} */ (dependency));
} }

Loading…
Cancel
Save