Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Chrome doesn't load additional search results when bottom is reached #14965

Merged
merged 7 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions app/search/client/provider/result.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { ReactiveVar } from 'meteor/reactive-var';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Session } from 'meteor/session';
Expand Down Expand Up @@ -39,9 +40,22 @@ Meteor.startup(function() {
});
});

Template.DefaultSearchResultTemplate.onCreated(function() {
const self = this;
Template.DefaultSearchResultTemplate.onRendered(function() {
const list = this.firstNode.parentNode.querySelector('.rocket-default-search-results');
this.autorun(() => {
const result = this.data.result.get();
if (result && this.hasMore.get()) {
Tracker.afterFlush(() => {
if (list.scrollHeight <= list.offsetHeight) {
this.data.payload.limit = (this.data.payload.limit || this.pageSize) + this.pageSize;
this.data.search();
}
});
}
});
});

Template.DefaultSearchResultTemplate.onCreated(function() {
// paging
this.pageSize = this.data.settings.PageSize;

Expand All @@ -50,11 +64,6 @@ Template.DefaultSearchResultTemplate.onCreated(function() {
this.data.parentPayload.searchAll = this.globalSearchEnabled;

this.hasMore = new ReactiveVar(true);
tassoevan marked this conversation as resolved.
Show resolved Hide resolved

this.autorun(() => {
const result = this.data.result.get();
self.hasMore.set(!(result && result.message.docs.length < (self.data.payload.limit || self.pageSize)));
});
});

Template.DefaultSearchResultTemplate.events({
Expand Down Expand Up @@ -86,7 +95,7 @@ Template.DefaultSearchResultTemplate.helpers({
return Template.instance().hasMore.get();
},
message(msg) {
return { customClass: 'search', actionContext: 'search', ...msg };
return { customClass: 'search', actionContext: 'search', ...msg, groupable: false };
},
messageContext,
});
1 change: 1 addition & 0 deletions app/search/client/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

.rocket-search-result {
display: flex;
overflow: hidden;
flex-direction: column;
flex: 1;
}
Expand Down
53 changes: 0 additions & 53 deletions app/theme/client/imports/general/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -219,56 +219,3 @@ button {
.hidden {
display: none;
}

.loading-animation {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;

display: flex;

text-align: center;
align-items: center;
justify-content: center;
}

.loading-animation > .bounce {
display: inline-block;

width: 10px;
height: 10px;
margin: 2px;

animation: loading-bouncedelay 1.4s infinite ease-in-out both;

border-radius: 100%;
background-color: rgba(255, 255, 255, 0.6);
}

.loading-animation .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.loading-animation .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

.file-picker-loading .loading-animation > .bounce {
background-color: #444444;
}

@keyframes loading-bouncedelay {
0%,
80%,
100% {
transform: scale(0);
}

40% {
transform: scale(1);
}
}
2 changes: 1 addition & 1 deletion app/ui-master/client/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './loading.html';
import './loading';
import './error.html';
import './logoLayout.html';
import './main.html';
Expand Down
2 changes: 2 additions & 0 deletions app/ui-master/client/loading/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './loading.css';
import './loading.html';
52 changes: 52 additions & 0 deletions app/ui-master/client/loading/loading.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.loading-animation {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;

display: flex;

text-align: center;
align-items: center;
justify-content: center;
}

.loading-animation > .bounce {
display: inline-block;

width: 10px;
height: 10px;
tassoevan marked this conversation as resolved.
Show resolved Hide resolved
margin: 2px;

animation: loading-bouncedelay 1.4s infinite ease-in-out both;

border-radius: 100%;
background-color: rgba(255, 255, 255, 0.6);
}

.loading-animation .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.loading-animation .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

.file-picker-loading .loading-animation > .bounce {
background-color: #444444;
}

@keyframes loading-bouncedelay {
0%,
80%,
100% {
transform: scale(0);
}

40% {
transform: scale(1);
}
}