Skip to content

Commit a339890

Browse files
committed
cleanup unused logic
1 parent b054746 commit a339890

File tree

3 files changed

+15
-39
lines changed

3 files changed

+15
-39
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { DEV } from 'esm-env';
33
import {
44
CLEAN,
55
DERIVED,
6-
DESTROYED,
76
DIRTY,
87
EFFECT_HAS_DERIVED,
98
MAYBE_DIRTY,
@@ -12,7 +11,6 @@ import {
1211
import {
1312
active_reaction,
1413
active_effect,
15-
remove_reactions,
1614
set_signal_status,
1715
skip_reaction,
1816
update_reaction,

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

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -241,26 +241,6 @@ export function spread_props(...props) {
241241
return new Proxy({ props }, spread_props_handler);
242242
}
243243

244-
/**
245-
* @template T
246-
* @param {() => T} fn
247-
* @returns {T}
248-
*/
249-
function with_parent_branch(fn) {
250-
var effect = active_effect;
251-
var previous_effect = active_effect;
252-
253-
while (effect !== null && (effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
254-
effect = effect.parent;
255-
}
256-
try {
257-
set_active_effect(effect);
258-
return fn();
259-
} finally {
260-
set_active_effect(previous_effect);
261-
}
262-
}
263-
264244
/**
265245
* This function is responsible for synchronizing a possibly bound prop with the inner component state.
266246
* It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
@@ -335,8 +315,8 @@ export function prop(props, key, flags, fallback) {
335315
} else {
336316
// Svelte 4 did not trigger updates when a primitive value was updated to the same value.
337317
// Replicate that behavior through using a derived
338-
var derived_getter = with_parent_branch(() =>
339-
(immutable ? derived : derived_safe_equal)(() => /** @type {V} */ (props[key]))
318+
var derived_getter = (immutable ? derived : derived_safe_equal)(
319+
() => /** @type {V} */ (props[key])
340320
);
341321
derived_getter.f |= LEGACY_DERIVED_PROP;
342322
getter = () => {
@@ -380,21 +360,19 @@ export function prop(props, key, flags, fallback) {
380360
// The derived returns the current value. The underlying mutable
381361
// source is written to from various places to persist this value.
382362
var inner_current_value = mutable_source(prop_value);
383-
var current_value = with_parent_branch(() =>
384-
derived(() => {
385-
var parent_value = getter();
386-
var child_value = get(inner_current_value);
387-
388-
if (from_child) {
389-
from_child = false;
390-
was_from_child = true;
391-
return child_value;
392-
}
363+
var current_value = derived(() => {
364+
var parent_value = getter();
365+
var child_value = get(inner_current_value);
366+
367+
if (from_child) {
368+
from_child = false;
369+
was_from_child = true;
370+
return child_value;
371+
}
393372

394-
was_from_child = false;
395-
return (inner_current_value.v = parent_value);
396-
})
397-
);
373+
was_from_child = false;
374+
return (inner_current_value.v = parent_value);
375+
});
398376

399377
if (!immutable) current_value.equals = safe_equals;
400378

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export function check_dirtiness(reaction) {
206206
// If the derived is owned by another derived then mark it as owned agaub
207207
// as the derived value might have been referenced in a different context
208208
// and now has a reacive context managing it
209-
derived.f ^= UNOWNED;
209+
// derived.f ^= UNOWNED;
210210
}
211211
}
212212

0 commit comments

Comments
 (0)