From 8b017572c3aeaba126a2c3665da3d5d908aae58a Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Thu, 11 Mar 2021 23:03:44 +0100 Subject: [PATCH 1/3] Fixed reindex button event sending Signed-off-by: Sebastian Fey --- src/components/AppSettings.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AppSettings.vue b/src/components/AppSettings.vue index 9791b0da3..973cb8190 100644 --- a/src/components/AppSettings.vue +++ b/src/components/AppSettings.vue @@ -12,7 +12,7 @@ : 'icon-history' " :title="t('cookbook', 'Rescan library')" - @click="emit('reindex')" + @click="$emit('reindex')" />
  • From 41366953084015d59482f5688de952ff32b59fa6 Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Fri, 12 Mar 2021 00:04:10 +0100 Subject: [PATCH 2/3] Moved recipe nutrition type sanity check to vue store Signed-off-by: Sebastian Fey --- src/components/EditMultiselectInputGroup.vue | 2 +- src/components/RecipeEdit.vue | 6 ------ src/store/index.js | 10 +++++++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/EditMultiselectInputGroup.vue b/src/components/EditMultiselectInputGroup.vue index a833b2f31..b16683c7c 100644 --- a/src/components/EditMultiselectInputGroup.vue +++ b/src/components/EditMultiselectInputGroup.vue @@ -82,7 +82,7 @@ export default { // Value (passed in v-model) value: { type: Object, - default: () => ({}), + default: () => {}, required: true, }, }, diff --git a/src/components/RecipeEdit.vue b/src/components/RecipeEdit.vue index d6fed87f8..597d28f64 100644 --- a/src/components/RecipeEdit.vue +++ b/src/components/RecipeEdit.vue @@ -541,12 +541,6 @@ export default { ) .then((response) => { const recipe = response.data - if ( - "nutrition" in recipe && - recipe.nutrition instanceof Array - ) { - recipe.nutrition = {} - } $this.$store.dispatch("setRecipe", { recipe }) $this.setup() }) diff --git a/src/store/index.js b/src/store/index.js index f631fb139..ae022b7db 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -62,7 +62,15 @@ export default new Vuex.Store({ state.page = p }, setRecipe(state, { r }) { - state.recipe = r + const rec = JSON.parse(JSON.stringify(r)) + if ( + "nutrition" in rec && + rec.nutrition instanceof Array + ) { + rec.nutrition = {} + } + state.recipe = rec + // Setting recipe also means that loading/reloading the recipe has finished state.loadingRecipe = 0 state.reloadingRecipe = 0 From 7c2cdd93db3e661e543652b872246d0363d4f45e Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Fri, 12 Mar 2021 00:09:40 +0100 Subject: [PATCH 3/3] Updated CHANGELOG and fixed style Signed-off-by: Sebastian Fey --- CHANGELOG.md | 6 ++++++ src/store/index.js | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4d408ef8..89000fdcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## [Unreleased] +### Fixed +- Calling reindex + [#653](https://github.com/nextcloud/cookbook/pull/653) @seyfeb +- Setting nutrition information on recipes with an array assigned for nutrition + [#653](https://github.com/nextcloud/cookbook/pull/653) @seyfeb + ## 0.8.4 - 2021-03-08 ### Added diff --git a/src/store/index.js b/src/store/index.js index ae022b7db..58c55ff4b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -63,10 +63,7 @@ export default new Vuex.Store({ }, setRecipe(state, { r }) { const rec = JSON.parse(JSON.stringify(r)) - if ( - "nutrition" in rec && - rec.nutrition instanceof Array - ) { + if ("nutrition" in rec && rec.nutrition instanceof Array) { rec.nutrition = {} } state.recipe = rec