Skip to content

Commit

Permalink
fix: improve single project selection handling for project dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Oct 18, 2024
1 parent e96d240 commit a9d6457
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<project-dropdown-selector
:projects="projects"
:model-value="selectedProjects"
:multiple="multiple"
@update:model-value="selectedProjects = $event"
/>
</template>

<script>
import { isArray } from 'lodash'
import ProjectDropdownSelector from '@/components/Project/ProjectDropdownSelector/ProjectDropdownSelector'
export default {
Expand All @@ -28,22 +29,19 @@ export default {
*/
disabled: {
type: Boolean
},
/**
* Select one or multiple
*/
multiple: {
type: Boolean
}
},
computed: {
projects() {
return this.$core.projects
},
multiple() {
return isArray(this.modelValue)
},
selectedProjects: {
get() {
if (!this.multiple) {
return [this.modelValue]
return this.$core.findProject(this.modelValue?.name)
}
return this.modelValue.filter(({ name }) => !!this.$core.findProject(name))
},
Expand Down

0 comments on commit a9d6457

Please sign in to comment.