-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boolean breaks interface #686
Comments
Start a new pull request in StackBlitz Codeflow. |
We also experienced this bug. It only breaks the SourceCodePreview and it only happens, when no attributes or props are set on a the component of the story: <Story>
<MyComponent></MyComponent>
</Story> Even setting an The issue lies here: histoire/packages/histoire-plugin-vue/src/client/codegen.ts Lines 123 to 124 in 692e6f5
Because Just checking if - // @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)) Sadly the source code in the npm package is minified, but we still managed to patch it with diff --git a/dist/bundled/client/codegen.js b/dist/bundled/client/codegen.js
index 6b922b51e716d6e5df1d0efd8358cbbf36f656c5..13ccbaa62998ae2b7e7934b6303a20dd74223249 100644
--- a/dist/bundled/client/codegen.js
+++ b/dist/bundled/client/codegen.js
@@ -38,7 +38,7 @@ async function k(e, o = null) {
t.startsWith("on") && (f = "@");
const L = f === "@" ? `${t[2].toLowerCase()}${t.slice(3)}` : t, M = [`onUpdate:${t}`, `onUpdate:${N(t)}`].find((p) => {
var $;
- return (($ = e.dynamicProps) == null ? void 0 : $.includes(p)) || p in e.props;
+ return (($ = e.dynamicProps) == null ? void 0 : $.includes(p)) || (e.props && p in e.props);
});
if (f === ":" && M) {
j.push(M);
|
Fixes histoire-dev#686 Co-authored-by: Louis Haftmann <30736553+LouisHaftmann@users.noreply.github.com>
Describe the bug
Add a boolean type prop to your component, select the checkbox in the histoire interface and obtain the below error:
Error: Cannot use 'in' operator to search for 'onUpdate:show' in null
it's not related to v-show, or v-if. Having the boolean on its own and selecting it, triggers the error.
Reproduction
https://stackblitz.com/edit/histoire-vue3-starter-tkzdzp
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: