Skip to content

Commit

Permalink
Improved: Enabled infinite scrolling when applying filters on landing…
Browse files Browse the repository at this point in the history
… pages (#531)
  • Loading branch information
R-Sourabh committed Dec 16, 2024
1 parent d51c990 commit 7380943
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
6 changes: 5 additions & 1 deletion src/store/modules/count/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ const actions: ActionTree<CountState, RootState> = {
} else if(router.currentRoute.value.name === "Closed") {
statusId = "INV_COUNT_COMPLETED"
}
dispatch("fetchCycleCounts", { statusId })
dispatch("fetchCycleCounts", { pageSize: process.env.VUE_APP_VIEW_SIZE, pageIndex: 0, statusId })
},

async updateQueryString({ commit }, payload) {
commit(types.COUNT_QUERY_UPDATED, payload)
},

async clearQuery({ commit }) {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/count/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const countModule: Module<CountState, RootState> = {
query: {
facilityIds: [],
noFacility: false,
queryString: []
queryString: ''
},
stats: {},
cycleCountImportSystemMessages:[],
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/count/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mutations: MutationTree <CountState> = {
state.query = {
facilityIds: [],
noFacility: false,
queryString: []
queryString: ''
}
},
[types.COUNT_STATS_UPDATED](state, payload) {
Expand Down
6 changes: 3 additions & 3 deletions src/views/Assigned.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ion-content ref="contentRef" :scroll-events="true" @ionScroll="enableScrolling()" id="filter">
<section>
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQuery('queryString', $event.target.value)" />
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQueryString('queryString', $event.target.value)" />
</section>
<p v-if="!cycleCounts.length" class="empty-state">
{{ translate("No cycle counts found") }}
Expand Down Expand Up @@ -103,8 +103,8 @@ function enableScrolling() {
}
}
async function updateQuery(key: string, value: any) {
await store.dispatch("count/updateQuery", { key, value })
async function updateQueryString(key: string, value: any) {
await store.dispatch("count/updateQueryString", { key, value })
fetchAssignedCycleCount();
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/Closed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ion-content ref="contentRef" :scroll-events="true" @ionScroll="enableScrolling()" id="filter">
<section>
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQuery('queryString', $event.target.value)" />
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQueryString('queryString', $event.target.value)" />
</section>
<p v-if="!cycleCounts.length" class="empty-state">
{{ translate("No cycle counts found") }}
Expand Down Expand Up @@ -149,8 +149,8 @@ function enableScrolling() {
}
}
async function updateQuery(key: string, value: any) {
await store.dispatch("count/updateQuery", { key, value })
async function updateQueryString(key: string, value: any) {
await store.dispatch("count/updateQueryString", { key, value })
fetchClosedCycleCounts();
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/Draft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ion-content ref="contentRef" :scroll-events="true" @ionScroll="enableScrolling()" id="filter">
<section>
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQuery('queryString', $event.target.value)" />
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQueryString('queryString', $event.target.value)" />
</section>
<p v-if="!cycleCounts.length" class="empty-state">
{{ translate("No cycle counts found") }}
Expand Down Expand Up @@ -120,8 +120,8 @@ function enableScrolling() {
}
}
async function updateQuery(key: string, value: any) {
await store.dispatch("count/updateQuery", { key, value })
async function updateQueryString(key: string, value: any) {
await store.dispatch("count/updateQueryString", { key, value })
fetchDraftCycleCounts();
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/PendingReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ion-content ref="contentRef" :scroll-events="true" @ionScroll="enableScrolling()" id="filter">
<section>
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQuery('queryString', $event.target.value)" />
<ion-searchbar v-model="query.queryString" @keyup.enter="updateQueryString('queryString', $event.target.value)" />
</section>
<p v-if="!cycleCounts.length" class="empty-state">
{{ translate("No cycle counts found") }}
Expand Down Expand Up @@ -103,8 +103,8 @@ function enableScrolling() {
}
}
async function updateQuery(key: string, value: any) {
await store.dispatch("count/updateQuery", { key, value })
async function updateQueryString(key: string, value: any) {
await store.dispatch("count/updateQueryString", { key, value })
fetchPendingCycleCounts();
}
Expand Down

0 comments on commit 7380943

Please sign in to comment.