Skip to content

Commit

Permalink
[FIX] Chrome doesn't load additional search results when botto… (Rock…
Browse files Browse the repository at this point in the history
…etChat#14965)

* fix scroll

* fix review

* ops
  • Loading branch information
ggazzo committed Jul 12, 2019
1 parent de83336 commit 7adfeca
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 58 deletions.
22 changes: 18 additions & 4 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 @@ -53,7 +67,7 @@ Template.DefaultSearchResultTemplate.onCreated(function() {

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

Expand Down Expand Up @@ -86,7 +100,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;
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);
}
}
File renamed without changes.

0 comments on commit 7adfeca

Please sign in to comment.