mirror of https://github.com/sveltejs/svelte
fix: ensure undefined attributes are removed during hydration (#16178)
* fix: ensure undefined attributes are removed during hydration Attributes that are `undefined` on the client should be removed during hydration, even if their value hasn't changed compared to `prev_value`. * Create plenty-wasps-sleep.md * added test * Update .changeset/plenty-wasps-sleep.md --------- Co-authored-by: Rich Harris <hello@rich-harris.dev>pull/16195/head
parent
a5f500e7c0
commit
579d0e6636
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: remove undefined attributes on hydration
|
@ -0,0 +1,11 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
server_props: {
|
||||
browser: false
|
||||
},
|
||||
|
||||
props: {
|
||||
browser: true
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
<!--[--><div></div><!--]-->
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
const { browser } = $props();
|
||||
|
||||
const attributes = {
|
||||
"data-test": browser ? undefined : ""
|
||||
};
|
||||
</script>
|
||||
|
||||
<div {...attributes}></div>
|
Loading…
Reference in new issue