fix(compiler): preserve server-only component props during hydration

This commit is contained in:
Clintchiz committed 2026-08-26 12:47:21 +05:30
1 parent bfa72d5679
commit 26af30cfe6
4 files changed
+14 -4

No files matched your search

@@ -3,10 +3,12 @@ import { generate, parse } from "../src/index.ts";
test("server-only loader data renders native input attributes without client state", async () => {
const code = generate(
parse(`page Profile {
parse(`import UserSelect from "./UserSelect.wrn"
page Profile {
load server account { return {} }
view {
<h1>{account.name}</h1>
<UserSelect value="{account.name}" options="{account.items}" />
{#if account.readonly}<p>Read only</p>{:else}<p>Editable</p>{/if}
{#each account.items as item}<strong>{item}</strong>{/each}
<input value="{account.name}" readonly="{account.readonly}" />
@@ -34,6 +36,7 @@ test("server-only loader data renders native input attributes without client sta
expect(html).toContain('<option value="dark" selected>Dark</option>');
expect(html).toContain('identity="{&quot;name&quot;:&quot;Alice&quot;}"');
expect(html).not.toContain("data-wrn-bind");
expect(html).not.toContain("data-wrn-prop-bind");
expect(html).not.toContain("{account.");
expect(html).toContain("<h1>A &quot;&lt;User&gt;&quot;</h1>");
expect(html).toContain("<p>Editable</p>");