fix(compiler): avoid deferred helper name collisions

This commit is contained in:
2026-08-09 13:34:17 +05:30
parent a90d3683d3
commit ca8aabf640
2 changed files with 18 additions and 2 deletions
@@ -184,3 +184,19 @@ test("deferred timer state writes commit after the client function returns", asy
expect(state.value).toBe(2);
expect(rendered).toBe("2");
});
test("the deferred commit helper does not shadow an authored commit function", () => {
const targets = generateTargets(
parse(`component AuthoredCommit {
state { value: number = 0 }
functions {
client function commit(): void { value = 1 }
client function save(): void { commit() }
}
view { <button @click='save()'>{value}</button> }
}`),
);
expect(() => new Function(targets.browser.replace(/^export\s+/gm, ""))).not.toThrow();
expect(targets.browser).not.toContain("const commit = __wrnexusCommit");
});