Skip to content

fix: render input default values in SSR#18483

Closed
mturac wants to merge 1 commit into
sveltejs:mainfrom
mturac:izon/fix-18446-input-defaultvalue-ssr
Closed

fix: render input default values in SSR#18483
mturac wants to merge 1 commit into
sveltejs:mainfrom
mturac:izon/fix-18446-input-defaultvalue-ssr

Conversation

@mturac

@mturac mturac commented Jun 29, 2026

Copy link
Copy Markdown

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Fixes #18446.

This makes SSR serialize input defaultValue/defaultChecked as value/checked, matching the initial DOM state users get after hydration. Explicit value/checked still wins when it is non-nullish, including checked={false}.

Test plan:

  • pnpm test runtime-runes -t input-default-value-ssr
  • pnpm test runtime-runes -t "form-default-value"
  • pnpm test
  • pnpm lint
  • pnpm check

I also temporarily reverted the implementation while keeping the new regression sample; pnpm test runtime-runes -t input-default-value-ssr failed in both SSR variants, then passed again after restoring the fix.

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e00a589

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mturac

mturac commented Jul 9, 2026

Copy link
Copy Markdown
Author

Closing this to avoid keeping a duplicate fix open for the same issue. #18452 is already open for #18446, so I will leave the review path there rather than split maintainer attention across two PRs.

@mturac mturac closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<input defaultValue="foo" /> doesn't populate until hydrated

1 participant