Skip to content

Commit

Permalink
fix: don't add accessor twice (#8996)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dummdidumm authored Jul 19, 2023
1 parent 657f113 commit cb1358c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/ten-gifts-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: don't add accessor twice
6 changes: 5 additions & 1 deletion packages/svelte/src/compiler/compile/render_dom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit cb1358c

Please sign in to comment.