fix: don't add accessor twice (#8996)

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/8928/head
Simon H 1 year ago committed by GitHub
parent 657f11376c
commit cb1358cc41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 slots_str = [...component.slots.keys()].map((key) => `"${key}"`).join(',');
const accessors_str = accessors 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}"`) .map((accessor) => `"${accessor.key.name}"`)
.join(','); .join(',');
const use_shadow_dom = const use_shadow_dom =

Loading…
Cancel
Save