Skip to content

Commit

Permalink
fix $$invalidate getting confused by an undefined third argument (sve…
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Jan 6, 2020
1 parent 741444d commit 6c4ebe3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Prevent text input cursor jumping in Safari with one-way binding ([#3449](https://github.com/sveltejs/svelte/issues/3449))
* Expose compiler version in dev events ([#4047](https://github.com/sveltejs/svelte/issues/4047))
* Fix reactive assignments with destructuring and stores where the destructured value should be undefined ([#4170](https://github.com/sveltejs/svelte/issues/4170))
* Do not automatically declare variables in reactive declarations when assigning to a member expression ([#4212](https://github.com/sveltejs/svelte/issues/4212))

## 3.16.7
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/internal/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ export function init(component, options, instance, create_fragment, not_equal, p
let ready = false;

$$.ctx = instance
? instance(component, prop_values, (i, ret, value = ret) => {
? instance(component, prop_values, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
if ($$.bound[i]) $$.bound[i](value);
if (ready) make_dirty(component, i);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
solo: true,
html: `
<p>undefined</p>
<p>undefined</p>
`
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
import { writable } from 'svelte/store';
const store = writable([]);
$: ({ foo1 } = $store);
$: [foo2] = $store;
</script>

<p>{foo1}</p>
<p>{foo2}</p>

0 comments on commit 6c4ebe3

Please sign in to comment.