Skip to content

Fix hydration state restoration for custom element attribute updates#18467

Open
fallintoplace wants to merge 1 commit into
sveltejs:mainfrom
fallintoplace:fix/hydration-attributes-restore
Open

Fix hydration state restoration for custom element attribute updates#18467
fallintoplace wants to merge 1 commit into
sveltejs:mainfrom
fallintoplace:fix/hydration-attributes-restore

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jun 25, 2026

Copy link
Copy Markdown

Problem

While hydrating custom elements, set_attributes temporarily disables global hydration state via set_hydrating(false) and restores it only at the end. If a prop setter or attribute operation throws partway through, hydration mode can remain disabled globally.

Fix

Wrap the temporary hydration-state override in a try/finally block in set_attributes so set_hydrating(true) always runs when is_hydrating_custom_element is true.

Validation

No runtime tests were run in this PR workflow. This is a control-flow safety fix to ensure state restoration under error conditions.

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.

1 participant