DEV: Eliminate "post bounce" after creating a post

Fix has two parts:
a) skips jumping to post if post is in view
b) debounces layout calculation when composer changes state
This commit is contained in:
Penar Musaraj 2020-02-11 14:04:46 -05:00
parent 3413ec0a5c
commit 30b7006ca2
2 changed files with 15 additions and 8 deletions

View File

@ -1,8 +1,11 @@
import { throttle } from "@ember/runloop";
import { run } from "@ember/runloop";
import { cancel } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop";
import { later } from "@ember/runloop";
import {
run,
cancel,
scheduleOnce,
later,
debounce,
throttle
} from "@ember/runloop";
import Component from "@ember/component";
import discourseComputed, { observes } from "discourse-common/utils/decorators";
import Composer from "discourse/models/composer";
@ -67,11 +70,15 @@ export default Component.extend(KeyEnterEscape, {
return;
}
const h = $("#reply-control:not(.saving)").height() || 0;
this.movePanels(h);
debounce(this, this.debounceMove, 300);
});
},
debounceMove() {
const h = $("#reply-control:not(.saving)").height() || 0;
this.movePanels(h);
},
keyUp() {
this.typed();

View File

@ -734,7 +734,7 @@ export default Controller.extend({
const post = result.target;
if (post && !staged) {
DiscourseURL.routeTo(post.url);
DiscourseURL.routeTo(post.url, { skipIfOnScreen: true });
}
})
.catch(error => {