svelte icon indicating copy to clipboard operation
svelte copied to clipboard

fix: ensure undefined attributes are removed during hydration

Open floriskn opened this issue 5 months ago • 5 comments

Attributes set server-side but undefined on the client should be removed during hydration. This ensures expected cleanup behavior and resolves a mismatch between SSR and client-side rendering.

Fixes sveltejs/svelte#16184

floriskn avatar Jun 16 '25 10:06 floriskn

🦋 Changeset detected

Latest commit: 574def131957c4358e85917771405bfaef5b6ab9

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

changeset-bot[bot] avatar Jun 16 '25 10:06 changeset-bot[bot]

Preview: https://svelte-dev-git-preview-svelte-16178-svelte.vercel.app/

svelte-docs-bot[bot] avatar Jun 16 '25 10:06 svelte-docs-bot[bot]

Please, add a test that fails without this fix. Propably it should go to the hydration folder, you can at the input-value-changed test as example of what you need.

7nik avatar Jun 16 '25 12:06 7nik

I’ve added the test under hydration named removes-undefined-attributes. It will fail without the fix, confirming the issue is properly covered.

floriskn avatar Jun 16 '25 14:06 floriskn

Playground

pnpm add https://pkg.pr.new/svelte@16178

github-actions[bot] avatar Jun 16 '25 14:06 github-actions[bot]