Skip to content

Commit

Permalink
fix: options list default value ignored (#4472)
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem authored Feb 6, 2025
1 parent e4e3d6c commit 4ae1eeb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions packages/ui/src/components/va-option-list/VaOptionList.stories.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import { defineComponent } from 'vue'
import VaOptionList from './VaOptionList.demo.vue'
import VaOptionListDemo from './VaOptionList.demo.vue'
import VaOptionList from './VaOptionList.vue'
import { StoryFn } from '@storybook/vue3'

export default {
title: 'VaOptionList',
component: VaOptionList,
}

export const Default = defineComponent({
components: { VaOptionListDemo },
template: '<VaOptionListDemo/>',
})

export const StatefulWithDefaultValue: StoryFn = () => ({
components: { VaOptionList },
template: '<VaOptionList/>',
setup () {
const planeOptions = ['test1', 'test2', 'test3']
return {
planeOptions,
}
},
template: '<VaOptionList :options="planeOptions" stateful :defaultValue="[planeOptions[0], planeOptions[2]]" />',
})
4 changes: 2 additions & 2 deletions packages/ui/src/composables/useStateful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const useStateful = <

const valueState = ref(
isUserProvidedProp.value
? defaultValuePassed ? defaultValue : props[key]
: props[key],
? props[key]
: defaultValuePassed ? defaultValue : props[key],
) as Ref<P[Key]>

let unwatchModelValue: ReturnType<typeof watch>
Expand Down

0 comments on commit 4ae1eeb

Please sign in to comment.