pull/15844/head
Rich Harris 2 months ago
parent ffc1f6bd5e
commit a7e0c84782

@ -59,7 +59,6 @@ import { UpdateExpression } from './visitors/UpdateExpression.js';
import { UseDirective } from './visitors/UseDirective.js';
import { AttachTag } from './visitors/AttachTag.js';
import { VariableDeclaration } from './visitors/VariableDeclaration.js';
import { Memoizer } from './visitors/shared/utils.js';
/** @type {Visitors} */
const visitors = {

@ -1,4 +1,4 @@
/** @import { BlockStatement, Expression } from 'estree' */
/** @import { BlockStatement } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../types' */
import { BLOCK_CLOSE, BLOCK_OPEN } from '../../../../../internal/server/hydration.js';

@ -22,7 +22,7 @@ export const USER_EFFECT = 1 << 20;
// Flags used for async
export const REACTION_IS_UPDATING = 1 << 21;
export const EFFECT_ASYNC = 1 << 22;
export const ASYNC = 1 << 22;
export const ERROR_VALUE = 1 << 23;

@ -7,7 +7,7 @@ import {
CLEAN,
DERIVED,
EFFECT,
EFFECT_ASYNC,
ASYNC,
MAYBE_DIRTY,
RENDER_EFFECT,
ROOT_EFFECT
@ -40,7 +40,7 @@ export function log_effect_tree(effect, depth = 0) {
label = 'boundary';
} else if ((flags & BLOCK_EFFECT) !== 0) {
label = 'block';
} else if ((flags & EFFECT_ASYNC) !== 0) {
} else if ((flags & ASYNC) !== 0) {
label = 'async';
} else if ((flags & BRANCH_EFFECT) !== 0) {
label = 'branch';

@ -2,7 +2,7 @@
import { UNINITIALIZED } from '../../../constants.js';
import { snapshot } from '../../shared/clone.js';
import { define_property } from '../../shared/utils.js';
import { DERIVED, EFFECT_ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';
import { DERIVED, ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';
import { effect_tracking } from '../reactivity/effects.js';
import { active_reaction, captured_signals, set_captured_signals, untrack } from '../runtime.js';
@ -26,7 +26,7 @@ function log_entry(signal, entry) {
return;
}
const type = (signal.f & (DERIVED | EFFECT_ASYNC)) !== 0 ? '$derived' : '$state';
const type = (signal.f & (DERIVED | ASYNC)) !== 0 ? '$derived' : '$state';
const current_reaction = /** @type {Reaction} */ (active_reaction);
const dirty = signal.wv > current_reaction.wv || current_reaction.wv === 0;
const style = dirty

@ -6,7 +6,7 @@ import {
DESTROYED,
DIRTY,
EFFECT,
EFFECT_ASYNC,
ASYNC,
INERT,
RENDER_EFFECT,
ROOT_EFFECT,
@ -248,7 +248,7 @@ export class Batch {
} else if (async_mode_flag && (flags & RENDER_EFFECT) !== 0) {
this.#render_effects.push(effect);
} else if (is_dirty(effect)) {
if ((flags & EFFECT_ASYNC) !== 0) {
if ((flags & ASYNC) !== 0) {
var effects = effect.b?.pending ? this.#boundary_async_effects : this.#async_effects;
effects.push(effect);
} else {

@ -11,7 +11,7 @@ import {
STALE_REACTION,
UNOWNED,
DESTROYED,
EFFECT_ASYNC
ASYNC
} from '#client/constants';
import {
active_reaction,
@ -194,7 +194,7 @@ export function async_derived(fn, location) {
if (DEV) {
// add a flag that lets this be printed as a derived
// when using `$inspect.trace()`
signal.f |= EFFECT_ASYNC;
signal.f |= ASYNC;
}
return new Promise((fulfil) => {

@ -34,7 +34,7 @@ import {
BOUNDARY_EFFECT,
STALE_REACTION,
USER_EFFECT,
EFFECT_ASYNC
ASYNC
} from '#client/constants';
import * as e from '../errors.js';
import { DEV } from 'esm-env';
@ -332,7 +332,7 @@ export function legacy_pre_effect_reset() {
* @returns {Effect}
*/
export function async_effect(fn) {
return create_effect(EFFECT_ASYNC | EFFECT_PRESERVED, fn, true);
return create_effect(ASYNC | EFFECT_PRESERVED, fn, true);
}
/**

@ -27,7 +27,7 @@ import {
MAYBE_DIRTY,
BLOCK_EFFECT,
ROOT_EFFECT,
EFFECT_ASYNC
ASYNC
} from '#client/constants';
import * as e from '../errors.js';
import { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';
@ -140,7 +140,7 @@ export function set(source, value, should_proxy = false) {
// to ensure we error if state is set inside an inspect effect
(!untracking || (active_reaction.f & INSPECT_EFFECT) !== 0) &&
is_runes() &&
(active_reaction.f & (DERIVED | BLOCK_EFFECT | EFFECT_ASYNC | INSPECT_EFFECT)) !== 0 &&
(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | INSPECT_EFFECT)) !== 0 &&
!current_sources?.includes(source)
) {
e.state_unsafe_mutation();

Loading…
Cancel
Save