diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts
index aa42286686..51edee8758 100644
--- a/src/compiler/compile/render_dom/wrappers/Element/index.ts
+++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts
@@ -497,7 +497,10 @@ export default class ElementWrapper extends Wrapper {
this.renderer.component.partly_hoisted.push(deindent`
function ${handler}(${contextual_dependencies.size > 0 ? `{ ${Array.from(contextual_dependencies).join(', ')} }` : ``}) {
${group.bindings.map(b => b.handler.mutation)}
- ${Array.from(dependencies).filter(dep => dep[0] !== '$').map(dep => `${this.renderer.component.invalidate(dep)};`)}
+ ${Array.from(dependencies)
+ .filter(dep => dep[0] !== '$')
+ .filter(dep => !contextual_dependencies.has(dep))
+ .map(dep => `${this.renderer.component.invalidate(dep)};`)}
}
`);
diff --git a/test/runtime/samples/each-block-scope-shadow-self/_config.js b/test/runtime/samples/each-block-scope-shadow-self/_config.js
new file mode 100644
index 0000000000..2b1a525aba
--- /dev/null
+++ b/test/runtime/samples/each-block-scope-shadow-self/_config.js
@@ -0,0 +1,17 @@
+export default {
+ html: '',
+ async test({ assert, component, target }) {
+ const input = target.querySelector('input');
+ input.value = 'svelte';
+ await input.dispatchEvent(new window.Event('input'));
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+
+ `
+ );
+ assert.deepEqual(component.data, { a: 'svelte', b: 'B', c: 'C' });
+ assert.deepEqual(component.x, ['a', 'b', 'c']);
+ },
+};
diff --git a/test/runtime/samples/each-block-scope-shadow-self/main.svelte b/test/runtime/samples/each-block-scope-shadow-self/main.svelte
new file mode 100644
index 0000000000..e3643c524a
--- /dev/null
+++ b/test/runtime/samples/each-block-scope-shadow-self/main.svelte
@@ -0,0 +1,15 @@
+
+
+{#each x as x}
+
+{/each}
\ No newline at end of file