DEV: Run post stream scroll events less often (#11463)

See PR for details.
This commit is contained in:
Penar Musaraj 2020-12-10 14:09:11 -05:00 committed by GitHub
parent 8940e0f163
commit b24a77ff91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,8 @@ import { isWorkaroundActive } from "discourse/lib/safari-hacks";
import offsetCalculator from "discourse/lib/offset-calculator";
import { inject as service } from "@ember/service";
const DEBOUNCE_DELAY = 50;
function findTopView($posts, viewportTop, postsWrapperTop, min, max) {
if (max < min) {
return min;
@ -311,14 +313,13 @@ export default MountWidget.extend({
},
_debouncedScroll() {
discourseDebounce(this, this._scrollTriggered, 10);
discourseDebounce(this, this._scrollTriggered, DEBOUNCE_DELAY);
},
didInsertElement() {
this._super(...arguments);
const debouncedScroll = () =>
discourseDebounce(this, this._scrollTriggered, 10);
discourseDebounce(this, this._scrollTriggered, DEBOUNCE_DELAY);
this._previouslyNearby = {};
this.appEvents.on("post-stream:refresh", this, "_debouncedScroll");