mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
fix: shopping list label editor (#1333)
* remove head props * lazily compute itemsByLabel with watcher on fetch * remove unused import
This commit is contained in:
parent
52fbf6b833
commit
5a0c034391
3 changed files with 12 additions and 10 deletions
|
@ -122,8 +122,5 @@ export default defineComponent({
|
||||||
listItem,
|
listItem,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
head: {
|
|
||||||
title: "vbase-nuxt",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
|
@ -130,7 +130,6 @@ import { validators } from "~/composables/use-validators";
|
||||||
import { useUserApi } from "~/composables/api";
|
import { useUserApi } from "~/composables/api";
|
||||||
import { IngredientFood } from "~/types/api-types/recipe";
|
import { IngredientFood } from "~/types/api-types/recipe";
|
||||||
import MultiPurposeLabel from "~/components/Domain/ShoppingList/MultiPurposeLabel.vue";
|
import MultiPurposeLabel from "~/components/Domain/ShoppingList/MultiPurposeLabel.vue";
|
||||||
import { MultiPurposeLabelSummary } from "~/types/api-types/labels";
|
|
||||||
import { useLocales } from "~/composables/use-locales";
|
import { useLocales } from "~/composables/use-locales";
|
||||||
import { useFoodStore, useLabelStore } from "~/composables/store";
|
import { useFoodStore, useLabelStore } from "~/composables/store";
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import draggable from "vuedraggable";
|
import draggable from "vuedraggable";
|
||||||
|
|
||||||
import { defineComponent, useAsync, useRoute, computed, ref } from "@nuxtjs/composition-api";
|
import { defineComponent, useAsync, useRoute, computed, ref, watch } from "@nuxtjs/composition-api";
|
||||||
import { useToggle } from "@vueuse/core";
|
import { useToggle } from "@vueuse/core";
|
||||||
import { useCopyList } from "~/composables/use-copy";
|
import { useCopyList } from "~/composables/use-copy";
|
||||||
import { useUserApi } from "~/composables/api";
|
import { useUserApi } from "~/composables/api";
|
||||||
|
@ -367,11 +367,13 @@ export default defineComponent({
|
||||||
return labels;
|
return labels;
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemsByLabel = computed(() => {
|
const itemsByLabel = ref<{ [key: string]: ShoppingListItemOut[] }>({});
|
||||||
const items: { [prop: string]: ShoppingListItemCreate[] } = {};
|
|
||||||
|
function updateItemsByLabel() {
|
||||||
|
const items: { [prop: string]: ShoppingListItemOut[] } = {};
|
||||||
|
|
||||||
const noLabel = {
|
const noLabel = {
|
||||||
"No Label": [] as ShoppingListItemCreate[],
|
"No Label": [] as ShoppingListItemOut[],
|
||||||
};
|
};
|
||||||
|
|
||||||
shoppingList.value?.listItems?.forEach((item) => {
|
shoppingList.value?.listItems?.forEach((item) => {
|
||||||
|
@ -394,7 +396,11 @@ export default defineComponent({
|
||||||
items["No Label"] = noLabel["No Label"];
|
items["No Label"] = noLabel["No Label"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
itemsByLabel.value = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(shoppingList, () => {
|
||||||
|
updateItemsByLabel();
|
||||||
});
|
});
|
||||||
|
|
||||||
async function refreshLabels() {
|
async function refreshLabels() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue