spread defaultvalue is incorrectly ssr'd
#16479
Development PR
Fixes #16479.
The default props: defaultValue, defaultChecked for inputs were previously not renamed for SSR when set from an object spread, leading to unexpected results.
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:, ordocs:. - 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 testand lint the project withpnpm lint
Issue
Solved
K
KTibow Jul 22, 2025, 6:49 PMDescribe the bug
take a component that includes an input with a defaultvalue (set via spreading). if you ssr the component, it fails to properly stringify this.
Reproduction
svelte repl link (go to js output and enable server):
the issue can be distilled down to
import * as $ from 'svelte/internal/server'; console.log($.spread_attributes({ defaultValue: 'default' }, null))
returning defaultvalue="default" instead of value="default"
Logs
System Info
System:
OS: Linux 6.14 Ubuntu 25.04 25.04 (Plucky Puffin)
CPU: (12) arm64 unknown
Memory: 8.75 GB / 14.20 GB
Container: Yes
Shell: 4.0.1 - /usr/bin/fish
Binaries:
Node: 24.4.0 - ~/.local/share/pnpm/node
npm: 11.4.2 - ~/.local/share/pnpm/npm
pnpm: 10.11.0 - ~/.local/share/pnpm/pnpm
Severity
annoyance
Info
Closed at Sep 11, 2025, 1:10 AM
Assignees None
Labels None
Milestone None