Skip to content

Commit

Permalink
refactor: simplify reactivity StoryblokRichText to doc only
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Jan 14, 2025
1 parent 908ad31 commit b13fa74
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/components/StoryblokRichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ const props = defineProps<StoryblokRichTextProps>();
const renderedDoc = ref();
const root = () => renderedDoc.value;
watch(
[props.doc, props.resolvers],
([doc, resolvers]) => {
const { render } = useStoryblokRichText({
resolvers: (resolvers as StoryblokRichTextResolvers<VNode>) ?? {},
});
renderedDoc.value = render(doc as StoryblokRichTextNode<VNode>);
},
{
immediate: true,
},
);
watch(props.doc, (doc) => {
const { render } = useStoryblokRichText({
resolvers: (props.resolvers as StoryblokRichTextResolvers<VNode>) ?? {},
});
renderedDoc.value = render(doc as StoryblokRichTextNode<VNode>);
}, {
immediate: true,
});
</script>

<template>
Expand Down

0 comments on commit b13fa74

Please sign in to comment.