From 72a584ba6002dd04522ebadafdf8015824e86a4b Mon Sep 17 00:00:00 2001 From: Julian Meinking <12785972+DrJume@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:44:07 +0100 Subject: [PATCH] fix(vue): codegen: check before using `in` on nullable object (#688) Co-authored-by: Louis Haftmann <30736553+LouisHaftmann@users.noreply.github.com> --- packages/histoire-plugin-vue/src/client/codegen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/histoire-plugin-vue/src/client/codegen.ts b/packages/histoire-plugin-vue/src/client/codegen.ts index 186b7a54..df0d64ce 100644 --- a/packages/histoire-plugin-vue/src/client/codegen.ts +++ b/packages/histoire-plugin-vue/src/client/codegen.ts @@ -121,7 +121,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record = n // v-model on component const vmodelListeners = [`onUpdate:${prop}`, `onUpdate:${camelCase(prop)}`] // @ts-ignore - const vmodelListener = vmodelListeners.find(key => vnode.dynamicProps?.includes(key) || key in vnode.props) + const vmodelListener = vmodelListeners.find(key => vnode.dynamicProps?.includes(key) || (vnode.props && key in vnode.props)) if (directive === ':' && vmodelListener) { // Listener skipProps.push(vmodelListener)