Skip to content

Commit 67cdf4c

Browse files
committed
fix: cannot redefine property error
1 parent 5cbd824 commit 67cdf4c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/shy-donkeys-judge.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"astro-portabletext": patch
3+
---
4+
5+
Fixes "Cannot redefine property: Symbol(astro-portabletext)" error
6+
7+
Astro in `dev` mode caused an issue on refresh

astro-portabletext/components/PortableText.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ const prepareForRender = (props: ComponentProps) => {
147147
component,
148148
children
149149
) => {
150-
Object.defineProperty(props.node, contextRef, {
151-
value: nodeSpec,
152-
});
150+
// Attach `contextRef` to node
151+
props.node = { ...props.node, [contextRef]: nodeSpec };
153152
154153
return [component, children ?? []];
155154
};

0 commit comments

Comments
 (0)