Skip to content

Commit

Permalink
Prove that synchronously changing names variable makes the error go away
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerRick committed Oct 1, 2020
1 parent 1048581 commit 116d83a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
10 changes: 2 additions & 8 deletions packages/my-new-component/dist/index.mjs
Expand Up @@ -360,14 +360,8 @@ function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
console.log("my-new-component FieldArray");
let names = ["a"];

setTimeout(
() => {
console.log("changing names to [a, b] from async callback");
$$invalidate(0, names = ["a", "b"]);
},
1000
);
console.log("synchronously changing names to [a, b]");
names = ["a", "b"];

$$self.$$set = $$props => {
if ("$$scope" in $$props) $$invalidate(1, $$scope = $$props.$$scope);
Expand Down
6 changes: 2 additions & 4 deletions packages/my-new-component/src/FieldArray.svelte
Expand Up @@ -2,10 +2,8 @@
console.log('my-new-component FieldArray')
let names = ['a']
setTimeout(() => {
console.log('changing names to [a, b] from async callback')
names = ['a', 'b']
}, 1000);
console.log('synchronously changing names to [a, b]')
names = ['a', 'b']
</script>

<slot names={names} />
10 changes: 2 additions & 8 deletions public/build/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 116d83a

Please sign in to comment.