-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Description
Bit of strange one, but here is a repro: https://svelte.dev/repl/67a7fb3e15fb4991916b9f6947c1e82a?version=3.2.2 (Note: will likely cause an infinite loop)
Here is the input:
<script>
const a = Promise.resolve('a');
let b = Promise.resolve('b');
let a_value, b_value;
$: a.then(value => a_value = value);
$: b.then(value => b_value = value);
$: b.then(value => { b_value = value });
</script>
and here is the relevant output:
function instance($$self, $$props, $$invalidate) {
const a = Promise.resolve('a');
let b = Promise.resolve('b');
let a_value, b_value;
$$self.$$.update = ($$dirty = { b: 1 }) => {
if ($$dirty.b) { b.then(value => { const $$result = b_value = value; $$invalidate('b_value', b_value), $$invalidate('b', b); return $$result; }); }
// Note the extra invalidate of b here ----------------------------------------------------------------^
if ($$dirty.b) { b.then(value => { $$invalidate('b_value', b_value = value) }); }
};
a.then(value => { const $$result = a_value = value; $$invalidate('a_value', a_value); return $$result; });
return {};
}
My guess is something related to mutation tracking (possibly tangentially related to #2728)