incremental-batches
Rich Harris 2 weeks ago
parent 2beb9eaf8f
commit 9d48444c50

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

@ -7,12 +7,10 @@ import {
CLEAN,
CONNECTED,
DERIVED,
DIRTY,
EFFECT,
ASYNC,
DESTROYED,
INERT,
MAYBE_DIRTY,
RENDER_EFFECT,
ROOT_EFFECT,
WAS_MARKED,
@ -208,8 +206,6 @@ export function log_reactions(signal) {
const names = [];
if ((flags & CLEAN) !== 0) names.push('CLEAN');
if ((flags & DIRTY) !== 0) names.push('DIRTY');
if ((flags & MAYBE_DIRTY) !== 0) names.push('MAYBE_DIRTY');
if ((flags & CONNECTED) !== 0) names.push('CONNECTED');
if ((flags & WAS_MARKED) !== 0) names.push('WAS_MARKED');
if ((flags & INERT) !== 0) names.push('INERT');
@ -266,7 +262,7 @@ export function log_reactions(signal) {
} else {
// It's an effect
const label = effect_label(/** @type {Effect} */ (reaction), true);
const status = (flags & MAYBE_DIRTY) !== 0 ? 'maybe dirty' : 'dirty';
const status = is_dirty(reaction) ? 'dirty' : 'clean';
// Collect parent statuses
/** @type {string[]} */
@ -387,8 +383,7 @@ export function log_inconsistent_branches(effect) {
const is_branch = (flags & BRANCH_EFFECT) !== 0;
if (is_branch) {
const status =
(flags & CLEAN) !== 0 ? 'clean' : (flags & MAYBE_DIRTY) !== 0 ? 'maybe dirty' : 'dirty';
const status = (flags & CLEAN) !== 0 ? 'clean' : 'dirty';
/** @type {BranchInfo[]} */
const child_branches = [];

@ -1,11 +1,5 @@
/** @import { Effect, Source, TemplateNode, } from '#client' */
import {
BOUNDARY_EFFECT,
DIRTY,
EFFECT_PRESERVED,
EFFECT_TRANSPARENT,
MAYBE_DIRTY
} from '#client/constants';
import { BOUNDARY_EFFECT, EFFECT_PRESERVED, EFFECT_TRANSPARENT } from '#client/constants';
import { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';
import { component_context, set_component_context } from '../../context.js';
import { handle_error, invoke_error_boundary } from '../../error-handling.js';

@ -11,7 +11,6 @@ import {
INERT,
RENDER_EFFECT,
ROOT_EFFECT,
MAYBE_DIRTY,
DERIVED,
EAGER_EFFECT,
ERROR_VALUE,
@ -1380,9 +1379,8 @@ export function fork(fn) {
await settled;
},
discard: () => {
// cause any MAYBE_DIRTY deriveds to update
// if they depend on things thath changed
// inside the discarded fork
// cause any deriveds to update if they depend on
// things that changed inside the discarded fork
for (var source of batch.current.keys()) {
source.wv = increment_write_version();
}

@ -14,7 +14,6 @@ import {
set_active_effect
} from '../runtime.js';
import {
DIRTY,
BRANCH_EFFECT,
RENDER_EFFECT,
EFFECT,
@ -28,7 +27,6 @@ import {
CLEAN,
EAGER_EFFECT,
HEAD_EFFECT,
MAYBE_DIRTY,
EFFECT_PRESERVED,
STALE_REACTION,
USER_EFFECT,

@ -7,7 +7,6 @@ import {
get,
set_untracked_writes,
untrack,
increment_write_version,
update_effect,
current_sources,
is_dirty,
@ -20,10 +19,8 @@ import { equals, safe_equals } from './equality.js';
import {
CLEAN,
DERIVED,
DIRTY,
BRANCH_EFFECT,
EAGER_EFFECT,
MAYBE_DIRTY,
BLOCK_EFFECT,
ROOT_EFFECT,
ASYNC,

@ -9,8 +9,6 @@ import {
} from './reactivity/effects.js';
import {
DIRTY,
MAYBE_DIRTY,
CLEAN,
DERIVED,
DESTROYED,
BRANCH_EFFECT,
@ -50,7 +48,6 @@ import {
} from './context.js';
import {
Batch,
batch_cvs,
batch_values,
batch_wvs,
current_batch,
@ -154,8 +151,7 @@ export function increment_write_version() {
}
/**
* Determines whether a derived or effect is dirty.
* If it is MAYBE_DIRTY, will set the status to CLEAN
* Determines whether a reaction is dirty
* @param {Reaction} reaction
* @returns {boolean}
*/
@ -303,7 +299,7 @@ export function update_reaction(reaction) {
untracked_writes !== null &&
!untracking &&
deps !== null &&
(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0
(reaction.f & (DERIVED | DIRTY)) === 0
) {
for (i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {
schedule_possible_effect_self_invalidation(

Loading…
Cancel
Save