fix: don't add accessor twice

In dev mode, Svelte creates a setter to throw an error noting that you can't set that readonly prop, which resulted in the accessor getting applied twice to the custom element wrapper, causing an error
fixes #8971
pull/8996/head
Simon Holthausen 3 years ago
parent 657f11376c
commit fb4e59a0df

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: don't add accessor twice

@ -583,7 +583,11 @@ export default function dom(component, options) {
}, {});
const slots_str = [...component.slots.keys()].map((key) => `"${key}"`).join(',');
const accessors_str = accessors
.filter((accessor) => !writable_props.some((prop) => prop.export_name === accessor.key.name))
.filter(
(accessor) =>
accessor.kind === 'get' &&
!writable_props.some((prop) => prop.export_name === accessor.key.name)
)
.map((accessor) => `"${accessor.key.name}"`)
.join(',');
const use_shadow_dom =

Loading…
Cancel
Save