Skip to content

Commit

Permalink
Merge pull request #810 from storyblok/bugfix/768-vue-warn-invalid-wa…
Browse files Browse the repository at this point in the history
…tch-source-at-storyblokrichtext

fix: enhance reactivity in StoryblokRichText by watching both doc and resolvers with deep true
  • Loading branch information
alvarosabu authored Jan 15, 2025
2 parents 71cd136 + 684bfd4 commit 9e939e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/StoryblokRichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ const props = defineProps<StoryblokRichTextProps>();
const renderedDoc = ref();
const root = () => renderedDoc.value;
watch(props.doc, (doc) => {
watch([() => props.doc, () => props.resolvers], ([doc, resolvers]) => {
const { render } = useStoryblokRichText({
resolvers: (props.resolvers as StoryblokRichTextResolvers<VNode>) ?? {},
resolvers: (resolvers as StoryblokRichTextResolvers<VNode>) ?? {},
});
renderedDoc.value = render(doc as StoryblokRichTextNode<VNode>);
}, {
immediate: true,
deep: true,
});
</script>

Expand Down

0 comments on commit 9e939e4

Please sign in to comment.