Skip to content

form.fields.fieldName.set('value'); is not server-side rendered #15327

@Stadly

Description

@Stadly

Describe the bug

form.fields.set({description: 'ssr'}); is server-side rendred, but form.fields.description.set('csr') is not.

<script>
	import { editData } from '$lib/data.remote.js';

	let { data } = $props();

	const form = editData;
	form.fields.set({description: 'ssr'});
	
	// Comment this out, and "ssr" is server-side rendered.
	// When it is uncommented, "" is server-side rendered and "csr" is set during hydration.
	form.fields.description.set('csr');
</script>


<div>
	Description: {form.fields.description.value()}
</div>

<form {...form}>
	<input {...form.fields.name.as('text')} />
	<button type="submit">Submit</button>
</form>

Reproduction

https://www.sveltelab.dev/v4da89zpg9l3f0h?files=.%2Fsrc%2Froutes%2F%2Bpage.svelte

Logs

System Info

SvelteLab

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    formsStuff relating to forms and form actions

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions