mirror of
https://github.com/discourse/discourse.git
synced 2025-03-15 04:45:27 +08:00
FIX: Avoid scroll jumping for topics on slow connections (#23290)
When the 'loading slider' navigation indicator is enabled, and a connection is very slow, we `display: none` most of the page and display a spinner. The `still-loading` body class for this was being added in the `afterRender` step in the Ember runloop. This meant that, depending on the order they were scheduled, other `afterRender` jobs may run before it. This caused an issue with topic scroll locations because we would attempt to scroll to an element which was `display: none` at the point its position was calculated. This commit moves the `still-loading` class manipulations to the `render` step of the runloop, which is technically more correct, and means that anything scheduled in the `afterRender` step is guaranteed to run without the `display: none` CSS. https://meta.discourse.org/t/276305/29
This commit is contained in:
parent
997c839626
commit
33d5845991
@ -108,13 +108,13 @@ export default class LoadingSlider extends Service.extend(Evented) {
|
|||||||
this.trigger("stateChanged", false);
|
this.trigger("stateChanged", false);
|
||||||
|
|
||||||
this.scheduleManager.cancelAll();
|
this.scheduleManager.cancelAll();
|
||||||
this.scheduleManager.schedule("afterRender", this.removeClasses);
|
this.scheduleManager.schedule("render", this.removeClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
setStillLoading() {
|
setStillLoading() {
|
||||||
this.stillLoading = true;
|
this.stillLoading = true;
|
||||||
this.scheduleManager.schedule("afterRender", this.addStillLoadingClass);
|
this.scheduleManager.schedule("render", this.addStillLoadingClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
|
Loading…
x
Reference in New Issue
Block a user