Skip to content

Commit

Permalink
fix: cannot redefine property error
Browse files Browse the repository at this point in the history
  • Loading branch information
theisel committed Oct 30, 2022
1 parent 5cbd824 commit 67cdf4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/shy-donkeys-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"astro-portabletext": patch
---

Fixes "Cannot redefine property: Symbol(astro-portabletext)" error

Astro in `dev` mode caused an issue on refresh
5 changes: 2 additions & 3 deletions astro-portabletext/components/PortableText.astro
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ const prepareForRender = (props: ComponentProps) => {
component,
children
) => {
Object.defineProperty(props.node, contextRef, {
value: nodeSpec,
});
// Attach `contextRef` to node
props.node = { ...props.node, [contextRef]: nodeSpec };
return [component, children ?? []];
};
Expand Down

0 comments on commit 67cdf4c

Please sign in to comment.