<script setup>
import { ref } from 'vue'
import { logEvent } from 'histoire/client'
import BaseButton from './BaseButton.vue'
let initStateNoBeuno = () => ({
color: "#f00",
})
let initStateBeuno = () => ({
props: {
color: "#f00"
}
})
const text = ref('Click me')
</script>
<template>
<Story >
<Variant
#default='{ state }' :init-state="initStateNoBeuno"
title='Unexpected properties'
>
<BaseButton v-bind="state">
{{ text }}
</BaseButton>
</Variant>
<Variant
#default='{ state }'
:init-state="initStateBeuno"
title='Nesting works'
>
<BaseButton v-bind="state.props">
{{ text }}
</BaseButton>
</Variant>
<template #controls>
<HstText title="default slot" v-model="text" />
</template>
</Story>
</template>
When using the init-state property, either on a story or a variant, unexpected properties show in the dynamic source preview as shown in the screen shot:
If you use a nested property, then these properties disappear.
Describe the bug
Consider the following story:
When using the init-state property, either on a story or a variant, unexpected properties show in the dynamic source preview as shown in the screen shot:
If you use a nested property, then these properties disappear.
Reproduction
https://stackblitz.com/edit/histoire-vue3-starter-nqsezx?file=src%2FBaseButton.story.vue
System Info
Used Package Manager
npm
Validations