Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: error showing in case of empty product while tab switch #466

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/views/CountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
</aside>
<!--Product details-->
<main class="main">
<div class="product" @scroll="onScroll">
<div class="product" @scroll="onScroll" v-if="filteredItems.length">
<div class="image ion-padding-top" v-for="item in filteredItems" :key="item.importItemSeqId" :data-product-id="item.productId" :data-seq="item.importItemSeqId" :id="`${item.productId}-${item.importItemSeqId}`">
<Image :src="getProduct(item.productId)?.mainImageUrl" />
</div>
</div>
<div class="detail">
<div class="detail" v-if="Object.keys(product)?.length">
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<h1>{{ getProductIdentificationValue(productStoreSettings["productIdentificationPref"].primaryId, getProduct(product.productId)) }}</h1>
Expand Down Expand Up @@ -345,10 +345,11 @@ function updateFilteredItems() {
});
}
if (filteredItems.value.length > 0) {
store.dispatch("product/currentProduct", product.value);
const item = filteredItems.value.find((item) => item.importItemSeqId === product.value.importItemSeqId)
store.dispatch("product/currentProduct", item ? product.value : filteredItems.value[0]);
updateNavigationState(filteredItems.value.indexOf(product.value));
} else {
store.dispatch("product/currentProduct", null);
store.dispatch("product/currentProduct", {});
isFirstItem.value = true
isLastItem.value = false
}
Expand Down Expand Up @@ -445,9 +446,9 @@ async function saveCount() {
product.value.quantity = inputCount.value
product.value.countedByGroupName = userProfile.value.userFullName
product.value.countedByUserLoginId = userProfile.value.username
await store.dispatch('product/currentProduct', product.value);
inputCount.value = '';
product.value.isRecounting = false;
await store.dispatch('product/currentProduct', product.value);
} else {
throw resp.data;
}
Expand Down
Loading