diff --git a/webapp/components/CategoriesSelect/CategoriesSelect.vue b/webapp/components/CategoriesSelect/CategoriesSelect.vue index 4f7a555a3..91fb7704c 100644 --- a/webapp/components/CategoriesSelect/CategoriesSelect.vue +++ b/webapp/components/CategoriesSelect/CategoriesSelect.vue @@ -43,6 +43,14 @@ export default { selectedCategoryIds: this.existingCategoryIds, } }, + watch: { + existingCategoryIds() { + if (!this.selectedCategoryIds.length && this.existingCategoryIds.length) { + this.selectedCategoryIds = this.existingCategoryIds + this.$forceUpdate() + } + }, + }, computed: { selectedCount() { return this.selectedCategoryIds.length diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 8863fbc8a..f740e1f05 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -177,6 +177,15 @@ export default { groupName() { return this.group && this.group.name }, + groupCategories() { + return this.group && this.group.categories + }, + }, + watch: { + groupCategories() { + if (!this.formData.categoryIds.length && this.groupCategories) + this.formData.categoryIds = this.groupCategories.map((cat) => cat.id) + }, }, methods: { submit() {