From faa51488f0b6b03f8bdb2e7b8144e8a735b30c71 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 7 Aug 2022 07:40:03 -0400 Subject: [PATCH] PLAN-677 new paging breaks other places collection/table mixin is used. Add fetchAll to fix --- app/javascript/profile/session_ranker.vue | 4 ++-- app/javascript/sessions/assign_participants.vue | 8 ++++---- app/javascript/store/table.mixin.js | 8 ++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/javascript/profile/session_ranker.vue b/app/javascript/profile/session_ranker.vue index e7b12bf7a..3d2cebe14 100644 --- a/app/javascript/profile/session_ranker.vue +++ b/app/javascript/profile/session_ranker.vue @@ -184,7 +184,7 @@ export default { this.removeInterest(this.assignment, this.person_id).then( (res) => { this.assignment = null - this.fetchPaged() + this.fetchAll() } ) } @@ -222,7 +222,7 @@ export default { // If there is no pager we need to get the initial collection somehow // Order should be by created_at date and ranking ... this.assignment = null - this.fetchPaged(); + this.fetchAll(); } } diff --git a/app/javascript/sessions/assign_participants.vue b/app/javascript/sessions/assign_participants.vue index 0fce2efec..09bbe7704 100644 --- a/app/javascript/sessions/assign_participants.vue +++ b/app/javascript/sessions/assign_participants.vue @@ -90,19 +90,19 @@ export default { }, methods: { reorder() { - this.fetchPaged(false) + this.fetchAll(false) }, saveAssignment(assignment) { this.save(assignment).then( () => { // TODO? // this.refreshSession() - this.fetchPaged(false) + this.fetchAll(false) } ).catch( () => { // this.refreshSession() - this.fetchPaged(false) + this.fetchAll(false) } ) }, @@ -120,7 +120,7 @@ export default { mounted() { // If there is no pager we need to get the initial collection somehow // Order should be by created_at date and ranking ... - this.fetchPaged(false); // false to not clear store of existing models + this.fetchAll(false); // false to not clear store of existing models this.select_model('session_assignment', null) this.select_model('person', null); } diff --git a/app/javascript/store/table.mixin.js b/app/javascript/store/table.mixin.js index 5da6ce205..08f2655a6 100644 --- a/app/javascript/store/table.mixin.js +++ b/app/javascript/store/table.mixin.js @@ -87,7 +87,7 @@ export const tableMixin = { this.tempCurrentPage = this.currentPage; } }, - fetchPaged(clear=true) { + fetchAll(clear=true, perPage=null) { this.tableBusy = true; this.shall_clear = clear let _filter = JSON.stringify(this.filter) @@ -108,7 +108,8 @@ export const tableMixin = { // What URL does this use this.fetch( { - perPage: this.perPage, + // THIS IS THE PROBLEM + perPage: perPage, sortOrder: this.sortDesc ? 'desc' : 'asc', sortBy: this.sortBy, filter: _filter, @@ -127,6 +128,9 @@ export const tableMixin = { res(data); }).catch(rej).finally(() => this.tableBusy = false); // TODO maybe actually handle it here?? }) + }, + fetchPaged(clear=true) { + this.fetchAll(clear, this.perPage); } }, mounted() {