Skip to content

Commit

Permalink
Merge pull request #276 from R-Sourabh/dxp-289
Browse files Browse the repository at this point in the history
Fixed: Infinite scroll with searchbar and loading bug(#289)
  • Loading branch information
ymaheshwari1 authored Apr 22, 2024
2 parents a856a05 + 016fcb5 commit 809ed47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/views/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
If we do not define an extra variable and just use v-show to check for `isScrollable` then when coming back to the page infinite-scroll is called programatically.
We have added an ionScroll event on ionContent to check whether the infiniteScroll can be enabled or not by toggling the value of isScrollingEnabled whenever the height < 0.
-->
<ion-infinite-scroll @ionInfinite="loadMoreProducts($event)" threshold="100px" v-show="isScrollingEnabled && isScrollable" ref="infiniteScrollRef">
<ion-infinite-scroll @ionInfinite="loadMoreProducts($event)" threshold="100px" v-show="isScrollable" ref="infiniteScrollRef">
<ion-infinite-scroll-content loading-spinner="crescent" :loading-text="$t('Loading')"></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-list>
Expand Down Expand Up @@ -152,6 +152,10 @@ export default defineComponent({
}
},
async loadMoreProducts (event: any) {
// Added this check here as if added on infinite-scroll component the Loading content does not gets displayed
if(!(this.isScrollingEnabled && this.isScrollable)) {
await event.target.complete();
}
this.searchProducts(
undefined,
Math.ceil(this.products.length / process.env.VUE_APP_VIEW_SIZE).toString()
Expand Down

0 comments on commit 809ed47

Please sign in to comment.