Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(search): fix pagination not updating
Browse files Browse the repository at this point in the history
- We had an optimization that only updated the hits when they actually
changed to reduce extra ajax request/processing but forgot exclude the
pagination data. So anytime the first page of results didnt change the
pagination data would update either.

Closes #2185
  • Loading branch information
Shane Wilson committed Apr 26, 2016
1 parent 0d3a020 commit 45ffbbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions app/scripts/query/query.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ module ngApp.query.controllers {
this.filesLoading = false;
this.files = this.files || {};
this.files.aggregations = data.aggregations;
this.files.pagination = data.pagination;

if (!_.isEqual(this.files.hits, data.hits)) {
this.files = data;
this.files.hits = data.hits;
this.tabSwitch = false;
if (this.QState.tabs.files.active) {
this.QState.setActive("files", "hasLoadedOnce");
Expand All @@ -129,9 +130,10 @@ module ngApp.query.controllers {
this.participantsLoading = false;
this.participants = this.participants || {};
this.participants.aggregations = data.aggregations;

this.participants.pagination = data.pagination

if (!_.isEqual(this.participants.hits, data.hits)) {
this.participants = data;
this.participants.hits = data.hits;
this.tabSwitch = false;
if (this.QState.tabs.participants.active) {
this.QState.setActive("participants", "hasLoadedOnce");
Expand Down
8 changes: 5 additions & 3 deletions app/scripts/search/search.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ module ngApp.search.controllers {
this.filesLoading = false;
this.files = this.files || {};
this.files.aggregations = data.aggregations;
this.files.pagination = data.pagination;

if (!_.isEqual(this.files.hits, data.hits)) {
this.files = data;
this.files.hits = data.hits;
this.tabSwitch = false;
if (this.SearchState.tabs.files.active) {
this.SearchState.setActive("tabs", "files", "hasLoadedOnce");
Expand All @@ -161,9 +162,10 @@ module ngApp.search.controllers {
this.participantsLoading = false;
this.participants = this.participants || {};
this.participants.aggregations = data.aggregations;

this.participants.pagination = data.pagination;

if (!_.isEqual(this.participants.hits, data.hits)) {
this.participants = data;
this.participants.hits = data.hits;
this.tabSwitch = false;
if (this.SearchState.tabs.participants.active) {
this.SearchState.setActive("tabs", "participants", "hasLoadedOnce");
Expand Down

0 comments on commit 45ffbbf

Please sign in to comment.