all non-unit tests passing

pull/17116/head
Rich Harris 3 weeks ago
parent c9d26db23f
commit db21188d4a

@ -369,11 +369,7 @@ export function update_derived(derived) {
if (batch_values !== null) { if (batch_values !== null) {
batch_values.set(derived, derived.v); batch_values.set(derived, derived.v);
} else { } else {
var status = var status = (derived.f & CONNECTED) === 0 ? MAYBE_DIRTY : CLEAN;
(skip_reaction || (derived.f & CONNECTED) === 0) && derived.deps !== null
? MAYBE_DIRTY
: CLEAN;
set_signal_status(derived, status); set_signal_status(derived, status);
} }
} }

@ -32,7 +32,8 @@ import {
EFFECT_PRESERVED, EFFECT_PRESERVED,
STALE_REACTION, STALE_REACTION,
USER_EFFECT, USER_EFFECT,
ASYNC ASYNC,
CONNECTED
} from '#client/constants'; } from '#client/constants';
import * as e from '../errors.js'; import * as e from '../errors.js';
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
@ -102,7 +103,7 @@ function create_effect(type, fn, sync, push = true) {
deps: null, deps: null,
nodes_start: null, nodes_start: null,
nodes_end: null, nodes_end: null,
f: type | DIRTY, f: type | DIRTY | CONNECTED,
first: null, first: null,
fn, fn,
last: null, last: null,

@ -272,7 +272,7 @@ export function update_reaction(reaction) {
reaction.deps = deps = new_deps; reaction.deps = deps = new_deps;
} }
if (is_updating_effect) { if (is_updating_effect && (reaction.f & CONNECTED) !== 0) {
for (i = skipped_deps; i < deps.length; i++) { for (i = skipped_deps; i < deps.length; i++) {
(deps[i].reactions ??= []).push(reaction); (deps[i].reactions ??= []).push(reaction);
} }
@ -626,6 +626,15 @@ export function get(signal) {
if (is_dirty(derived)) { if (is_dirty(derived)) {
update_derived(derived); update_derived(derived);
} }
// reconnect a disconnected derived to the graph
if (is_updating_effect && (derived.f & CONNECTED) === 0 && derived.deps !== null) {
derived.f |= CONNECTED;
for (const dep of derived.deps) {
(dep.reactions ??= []).push(derived);
}
}
} }
if (batch_values?.has(signal)) { if (batch_values?.has(signal)) {

Loading…
Cancel
Save