Skip to content

Commit c9d6195

Browse files
committed
make purpose explicit
1 parent d155191 commit c9d6195

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

packages/svelte/src/internal/client/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const EFFECT_TRANSPARENT = 1 << 17;
1919
export const LEGACY_DERIVED_PROP = 1 << 18;
2020
export const INSPECT_EFFECT = 1 << 19;
2121
export const HEAD_EFFECT = 1 << 20;
22-
export const EFFECT_HAS_DERIVED = 1 << 21;
22+
export const EFFECT_PRESERVED = 1 << 21; // effects with this flag should not be pruned
2323

2424
// Flags used for async
2525
export const REACTION_IS_UPDATING = 1 << 22;

packages/svelte/src/internal/client/dom/blocks/boundary.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import {
44
BOUNDARY_EFFECT,
55
BOUNDARY_SUSPENDED,
6+
EFFECT_PRESERVED,
67
EFFECT_TRANSPARENT,
78
RENDER_EFFECT
89
} from '../../constants.js';
@@ -63,6 +64,8 @@ function with_boundary(boundary, fn) {
6364
}
6465
}
6566

67+
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED | BOUNDARY_EFFECT;
68+
6669
/**
6770
* @param {TemplateNode} node
6871
* @param {{
@@ -317,7 +320,7 @@ export function boundary(node, props, children) {
317320
}
318321

319322
reset_is_throwing_error();
320-
}, EFFECT_TRANSPARENT | BOUNDARY_EFFECT);
323+
}, flags);
321324

322325
if (hydrating) {
323326
anchor = hydrate_node;

packages/svelte/src/internal/client/reactivity/deriveds.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
DERIVED,
66
DESTROYED,
77
DIRTY,
8-
EFFECT_HAS_DERIVED,
8+
EFFECT_PRESERVED,
99
MAYBE_DIRTY,
1010
UNOWNED
1111
} from '../constants.js';
@@ -58,7 +58,7 @@ export function derived(fn) {
5858
} else {
5959
// Since deriveds are evaluated lazily, any effects created inside them are
6060
// created too late to ensure that the parent effect is added to the tree
61-
active_effect.f |= EFFECT_HAS_DERIVED;
61+
active_effect.f |= EFFECT_PRESERVED;
6262
}
6363

6464
/** @type {Derived<V>} */
@@ -140,7 +140,7 @@ export function async_derived(fn) {
140140
// TODO we should probably null out active effect here,
141141
// rather than inside `restore()`
142142
}
143-
}, EFFECT_HAS_DERIVED);
143+
}, EFFECT_PRESERVED);
144144

145145
return Promise.resolve(promise).then(() => value);
146146
}

packages/svelte/src/internal/client/reactivity/effects.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
INSPECT_EFFECT,
3535
HEAD_EFFECT,
3636
MAYBE_DIRTY,
37-
EFFECT_HAS_DERIVED,
37+
EFFECT_PRESERVED,
3838
BOUNDARY_EFFECT
3939
} from '../constants.js';
4040
import { set } from './sources.js';
@@ -147,7 +147,7 @@ function create_effect(type, fn, sync, push = true) {
147147
effect.first === null &&
148148
effect.nodes_start === null &&
149149
effect.teardown === null &&
150-
(effect.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0;
150+
(effect.f & EFFECT_PRESERVED) === 0;
151151

152152
if (!inert && !is_root && push) {
153153
if (parent_effect !== null) {

0 commit comments

Comments
 (0)