mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-26 00:05:10 -07:00
fix: Can't add first shopping list item to shopping list (#6013)
This commit is contained in:
parent
cac1699aeb
commit
347af7d417
3 changed files with 7 additions and 3 deletions
|
@ -69,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
v-if="listItem.labelId && listItem.food && listItem.labelId !== listItem.food.labelId"
|
v-if="listItem.labelId && listItem.food && listItem.labelId !== listItem.food.labelId"
|
||||||
size="small"
|
small
|
||||||
color="info"
|
color="info"
|
||||||
:icon="$globals.icons.tagArrowRight"
|
:icon="$globals.icons.tagArrowRight"
|
||||||
:text="$t('shopping-list.save-label')"
|
:text="$t('shopping-list.save-label')"
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
:min="min"
|
:min="min"
|
||||||
:max="max"
|
:max="max"
|
||||||
type="number"
|
type="number"
|
||||||
size="small"
|
|
||||||
variant="plain"
|
variant="plain"
|
||||||
|
density="compact"
|
||||||
|
style="width: 60px;"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -150,7 +150,10 @@ export function useShoppingListCrud(
|
||||||
|
|
||||||
loadingCounter.value += 1;
|
loadingCounter.value += 1;
|
||||||
|
|
||||||
// make sure it's inserted into the end of the list, which may have been updated
|
// ensure list id is set to the current list, which may not have loaded yet in the factory
|
||||||
|
createListItemData.value.shoppingListId = shoppingList.value.id;
|
||||||
|
|
||||||
|
// ensure item is inserted into the end of the list, which may have been updated
|
||||||
createListItemData.value.position = shoppingList.value?.listItems?.length
|
createListItemData.value.position = shoppingList.value?.listItems?.length
|
||||||
? (shoppingList.value.listItems.reduce((a, b) => (a.position || 0) > (b.position || 0) ? a : b).position || 0) + 1
|
? (shoppingList.value.listItems.reduce((a, b) => (a.position || 0) > (b.position || 0) ? a : b).position || 0) + 1
|
||||||
: 0;
|
: 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue