pull/18062/merge
Rich Harris 4 months ago
parent e9a418f78a
commit 3413d3d5ff

@ -23,7 +23,6 @@ export const BOUNDARY_EFFECT = 1 << 7;
*/
export const CONNECTED = 1 << 9;
export const CLEAN = 1 << 10;
export const DIRTY = 1 << 11;
export const INERT = 1 << 13;
export const DESTROYED = 1 << 14;
/** Set once a reaction has run for the first time */

@ -5,7 +5,6 @@ import {
BRANCH_EFFECT,
CLEAN,
DESTROYED,
DIRTY,
EFFECT,
ASYNC,
INERT,
@ -180,7 +179,7 @@ export class Batch {
#new_deriveds = [];
/**
* Deferred effects (which run after async work has completed) that are DIRTY
* Deferred effects (which run after async work has completed) that are dirty
* @type {Set<Effect>}
*/
#dirty_effects = new Set();
@ -1044,11 +1043,7 @@ function mark_effects(batch, value, sources, marked, checked) {
if ((flags & DERIVED) !== 0) {
mark_effects(batch, /** @type {Derived} */ (reaction), sources, marked, checked);
} else if (
(flags & (ASYNC | BLOCK_EFFECT)) !== 0 &&
(flags & DIRTY) === 0 &&
depends_on(reaction, sources, checked)
) {
} else if ((flags & (ASYNC | BLOCK_EFFECT)) !== 0 && depends_on(reaction, sources, checked)) {
batch.schedule(/** @type {Effect} */ (reaction));
batch.cvs.set(reaction, -1);
}

@ -5,7 +5,6 @@ import { DEV } from 'esm-env';
import {
ERROR_VALUE,
DERIVED,
DIRTY,
EFFECT_PRESERVED,
STALE_REACTION,
ASYNC,
@ -19,7 +18,6 @@ import {
update_reaction,
set_active_effect,
push_reaction_value,
is_destroying_effect,
update_effect,
remove_reactions,
write_version
@ -27,21 +25,15 @@ import {
import { equals, safe_equals } from './equality.js';
import * as e from '../errors.js';
import * as w from '../warnings.js';
import {
async_effect,
destroy_effect,
destroy_effect_children,
effect_tracking,
teardown
} from './effects.js';
import { async_effect, destroy_effect, destroy_effect_children, teardown } from './effects.js';
import { eager_effects, internal_set, set_eager_effects, source } from './sources.js';
import { get_error } from '../../shared/dev.js';
import { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';
import { component_context } from '../context.js';
import { UNINITIALIZED } from '../../../constants.js';
import { batch_values, batch_wvs, current_batch, get_wv, set_cv } from './batch.js';
import { batch_wvs, current_batch, get_wv, set_cv } from './batch.js';
import { increment_pending, unset_context } from './async.js';
import { deferred, includes, noop } from '../../shared/utils.js';
import { deferred, noop } from '../../shared/utils.js';
/**
* This allows us to track 'reactivity loss' that occurs when signals
@ -64,7 +56,6 @@ export const recent_async_deriveds = new Set();
*/
/*#__NO_SIDE_EFFECTS__*/
export function derived(fn) {
var flags = DERIVED | DIRTY;
var parent_derived =
active_reaction !== null && (active_reaction.f & DERIVED) !== 0
? /** @type {Derived} */ (active_reaction)
@ -82,7 +73,7 @@ export function derived(fn) {
deps: null,
effects: null,
equals,
f: flags,
f: DERIVED,
fn,
reactions: null,
cv: -1,

@ -8,7 +8,6 @@ import {
execute_effect_teardown
} from './reactivity/effects.js';
import {
DIRTY,
DERIVED,
DESTROYED,
BRANCH_EFFECT,
@ -299,7 +298,7 @@ export function update_reaction(reaction) {
untracked_writes !== null &&
!untracking &&
deps !== null &&
(reaction.f & (DERIVED | DIRTY)) === 0
(reaction.f & DERIVED) === 0
) {
for (i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {
schedule_possible_effect_self_invalidation(
@ -473,7 +472,7 @@ export function update_effect(effect) {
// In DEV, increment versions of any sources that were written to during the effect,
// so that they are correctly marked as dirty when the effect re-runs
if (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) {
if (DEV && tracing_mode_flag && effect.deps !== null) {
for (var dep of effect.deps) {
if (dep.set_during_effect) {
dep.wv = increment_write_version();

@ -1,6 +1,6 @@
/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
/** @import { Derived, Value } from '#client' */
import { DERIVED, DIRTY, EFFECT_LEGACY, LEGACY_PROPS } from '../internal/client/constants.js';
import { DERIVED, EFFECT_LEGACY, LEGACY_PROPS } from '../internal/client/constants.js';
import { user_pre_effect } from '../internal/client/reactivity/effects.js';
import { mutable_source, set } from '../internal/client/reactivity/sources.js';
import { hydrate, mount, unmount } from '../internal/client/render.js';
@ -9,10 +9,9 @@ import {
get,
new_deps,
skipped_deps,
untracked_writes,
write_version
untracked_writes
} from '../internal/client/runtime.js';
import { flushSync, get_cv } from '../internal/client/reactivity/batch.js';
import { flushSync } from '../internal/client/reactivity/batch.js';
import { define_property, is_array } from '../internal/shared/utils.js';
import * as e from '../internal/client/errors.js';
import * as w from '../internal/client/warnings.js';

Loading…
Cancel
Save