Skip to content

Commit

Permalink
Fix bind handler invalidating other variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
discapes authored Jul 21, 2022
1 parent 01ba78a commit 31b468a
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/compiler/compile/render_dom/invalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,5 @@ export function renderer_invalidate(renderer: Renderer, name: string, value?, ma

if (main_execution_context) return;

// if this is a reactive declaration, invalidate dependencies recursively
const deps = new Set([name]);

deps.forEach(name => {
const reactive_declarations = renderer.component.reactive_declarations.filter(x =>
x.assignees.has(name)
);
reactive_declarations.forEach(declaration => {
declaration.dependencies.forEach(name => {
deps.add(name);
});
});
});

// TODO ideally globals etc wouldn't be here in the first place
const filtered = Array.from(deps).filter(n => renderer.context_lookup.has(n));
if (!filtered.length) return null;

return filtered
.map(n => x`$$invalidate(${renderer.context_lookup.get(n).index}, ${n})`)
.reduce((lhs, rhs) => x`${lhs}, ${rhs}`);
return x`$$invalidate(${renderer.context_lookup.get(name).index}, ${name})`;
}

0 comments on commit 31b468a

Please sign in to comment.