Merge branch 'each-static-update' of https://github.com/BillyLevin/svelte into BillyLevin-each-static-update

pull/4870/head
Richard Harris 5 years ago
commit cb7302e9bf

@ -96,6 +96,19 @@ export default class EachBlockWrapper extends Wrapper {
bindings: new Map(block.bindings)
});
const reassigned_deps: Set<string> = new Set();
block.dependencies.forEach(dep => {
const info = renderer.context_lookup.get(dep);
if (info && info.variable.reassigned) {
reassigned_deps.add(dep);
}
});
if (reassigned_deps.size) {
this.block.add_dependencies(reassigned_deps);
}
// TODO this seems messy
this.block.has_animation = this.node.has_animation;

@ -0,0 +1,7 @@
export default {
html: ``,
test({ assert, target }) {
assert.htmlEqual(target.innerHTML, `staticstatic`);
}
};

@ -0,0 +1,13 @@
<script>
import { onMount } from 'svelte';
let arr = [1];
onMount(() => {
arr.push(arr.length + 1);
arr = arr;
});
</script>
{#each arr as num}
static
{/each}
Loading…
Cancel
Save