Skip to content

Commit cb1358c

Browse files
authored
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
1 parent 657f113 commit cb1358c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/ten-gifts-design.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: don't add accessor twice

packages/svelte/src/compiler/compile/render_dom/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,11 @@ export default function dom(component, options) {
583583
}, {});
584584
const slots_str = [...component.slots.keys()].map((key) => `"${key}"`).join(',');
585585
const accessors_str = accessors
586-
.filter((accessor) => !writable_props.some((prop) => prop.export_name === accessor.key.name))
586+
.filter(
587+
(accessor) =>
588+
accessor.kind === 'get' &&
589+
!writable_props.some((prop) => prop.export_name === accessor.key.name)
590+
)
587591
.map((accessor) => `"${accessor.key.name}"`)
588592
.join(',');
589593
const use_shadow_dom =

0 commit comments

Comments
 (0)