Skip to content

Commit

Permalink
Merge pull request #491 from ymaheshwari1/#442
Browse files Browse the repository at this point in the history
Fixed: both the item change buttons becomes active after changing tab(#442)
  • Loading branch information
ymaheshwari1 authored Nov 5, 2024
2 parents 0234591 + fa2126a commit 6532e11
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/views/CountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ function updateFilteredItems() {
});
}
if (filteredItems.value.length > 0) {
const updatedProduct = Object.keys(product.value)?.length ? product.value : filteredItems.value[0]
// As we want to get the index of the product, if we directly store the product in the updatedProduct variable it does not return the index
// as both the object becomes different because of the reference, so if we have a product, then first finding it in the filtered list to have a common reference and then getting the index
const updatedProduct = Object.keys(product.value)?.length ? filteredItems.value.find((item) => item.productId === product.value.productId && item.importItemSeqId === product.value.importItemSeqId) : filteredItems.value[0]
store.dispatch("product/currentProduct", updatedProduct);
updateNavigationState(filteredItems.value.indexOf(updatedProduct));
} else {
Expand Down

0 comments on commit 6532e11

Please sign in to comment.