mirror of https://github.com/sveltejs/svelte
[fix] Spread component props immutably during SSR (#8176)
By passing an empty object literal as first argument to Object.assign we can avoid having objects spread as props on a component being mutated during SSR. Fixes #8171pull/8190/head
parent
aa98397440
commit
b06e435684
@ -0,0 +1,15 @@
|
||||
const obj = {
|
||||
x: 1,
|
||||
y: 2,
|
||||
z: 3
|
||||
};
|
||||
|
||||
export default {
|
||||
props: {
|
||||
obj
|
||||
},
|
||||
|
||||
test({ assert }) {
|
||||
assert.deepEqual(obj, { x: 1, y: 2, z: 3 });
|
||||
}
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import Widget from './Widget.svelte';
|
||||
|
||||
export let obj;
|
||||
</script>
|
||||
|
||||
<Widget {...obj} x={2} />
|
Loading…
Reference in new issue