Skip to content

Commit d155191

Browse files
committed
fix
1 parent 5969b09 commit d155191

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
});
143+
}, EFFECT_HAS_DERIVED);
144144

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

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -997,18 +997,14 @@ export function get(signal) {
997997
} else {
998998
// we're adding a dependency outside the init/update cycle
999999
// (i.e. after an `await`)
1000-
// TODO we probably want to disable this for user effects,
1001-
// otherwise it's a breaking change, albeit a desirable one?
1002-
if (deps === null) {
1003-
deps = [signal];
1004-
} else if (!deps.includes(signal)) {
1005-
deps.push(signal);
1006-
}
1000+
(active_reaction.deps ??= []).push(signal);
1001+
1002+
var reactions = signal.reactions;
10071003

1008-
if (signal.reactions === null) {
1004+
if (reactions === null) {
10091005
signal.reactions = [active_reaction];
1010-
} else if (!signal.reactions.includes(active_reaction)) {
1011-
signal.reactions.push(active_reaction);
1006+
} else if (!reactions.includes(active_reaction)) {
1007+
reactions.push(active_reaction);
10121008
}
10131009
}
10141010
} else if (

0 commit comments

Comments
 (0)