Skip to content

Commit

Permalink
Fixed: the case where loading label is not displayed when infinite sc…
Browse files Browse the repository at this point in the history
…rolling(#289)
  • Loading branch information
R-Sourabh committed Apr 19, 2024
1 parent 897b2fd commit 9cf1ba1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/views/catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</ion-item> -->
</div>

<ion-infinite-scroll @ionInfinite="loadMoreProducts($event)" threshold="100px" v-show="isScrollingEnabled && isCatalogScrollable" ref="infiniteScrollRef">
<ion-infinite-scroll @ionInfinite="loadMoreProducts($event)" threshold="100px" v-show="isCatalogScrollable" ref="infiniteScrollRef">
<ion-infinite-scroll-content loading-spinner="crescent" :loading-text="$t('Loading')" />
</ion-infinite-scroll>
</div>
Expand Down Expand Up @@ -214,6 +214,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.isCatalogScrollable)) {
await event.target.complete();
}
this.getCatalogProducts(
undefined,
Math.ceil(this.products.length / process.env.VUE_APP_VIEW_SIZE).toString()
Expand Down
6 changes: 5 additions & 1 deletion src/views/orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,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="loadMoreOrders($event)" threshold="100px" id="infinite-scroll" v-show="isScrollingEnabled && isScrolleable" ref="infiniteScrollRef">
<ion-infinite-scroll @ionInfinite="loadMoreOrders($event)" threshold="100px" id="infinite-scroll" v-show="isScrolleable" ref="infiniteScrollRef">
<ion-infinite-scroll-content loading-spinner="crescent" :loading-text="$t('Loading')"></ion-infinite-scroll-content>
</ion-infinite-scroll>
</div>
Expand Down Expand Up @@ -308,6 +308,10 @@ export default defineComponent({
}
},
async loadMoreOrders(event: any) {
// Added this check here as if added on infinite-scroll component the Loading content does not gets displayed
if(!(this.isScrollingEnabled && this.isScrolleable)) {
await event.target.complete();
}
this.query.viewIndex = Math.ceil(this.orders.length / process.env.VUE_APP_VIEW_SIZE);
this.store.dispatch("order/updateQuery", { query: this.query}).then(async () => {
await event.target.complete();
Expand Down
6 changes: 5 additions & 1 deletion src/views/products.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ion-badge slot="end" color="success">{{ product.doclist.numFound }} {{ $t("pieces preordered") }}</ion-badge>
</ion-item>

<ion-infinite-scroll @ionInfinite="loadMoreProducts($event)" threshold="100px" id="infinite-scroll" v-show="isScrollingEnabled && isScrolleable" ref="infiniteScrollRef">
<ion-infinite-scroll @ionInfinite="loadMoreProducts($event)" threshold="100px" id="infinite-scroll" v-show="isScrolleable" ref="infiniteScrollRef">
<ion-infinite-scroll-content loading-spinner="crescent" :loading-text="$t('Loading')"></ion-infinite-scroll-content>
</ion-infinite-scroll>
</div>
Expand Down Expand Up @@ -131,6 +131,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.isScrolleable)) {
await event.target.complete();
}
this.getProducts(
undefined,
Math.ceil(this.products.length / process.env.VUE_APP_VIEW_SIZE).toString()
Expand Down

0 comments on commit 9cf1ba1

Please sign in to comment.