DEV: Don't transition miniprofiler on first page load. (#14265)

See https://meta.discourse.org/t/-/202482/5
This commit is contained in:
Alan Guo Xiang Tan
2021-09-07 13:44:49 +08:00
committed by GitHub
parent fc1fd1b416
commit aaa8a379b9
2 changed files with 6 additions and 6 deletions

View File

@@ -15,8 +15,8 @@ export default {
const router = container.lookup("router:main");
router.on("routeWillChange", viewTrackingRequired);
router.on("routeDidChange", () => {
cleanDOM(container);
router.on("routeDidChange", (transition) => {
cleanDOM(container, { skipMiniProfilerPageTransition: !transition.from });
});
let appEvents = container.lookup("service:app-events");

View File

@@ -1,7 +1,7 @@
import { scheduleOnce } from "@ember/runloop";
function _clean() {
if (window.MiniProfiler) {
function _clean(opts = {}) {
if (window.MiniProfiler && !opts.skipMiniProfilerPageTransition) {
window.MiniProfiler.pageTransition();
}
@@ -29,6 +29,6 @@ function _clean() {
this.lookup("service:document-title").updateContextCount(0);
}
export function cleanDOM(container) {
scheduleOnce("afterRender", container, _clean);
export function cleanDOM(container, opts) {
scheduleOnce("afterRender", container, _clean, opts);
}