UX: opens side panel early to avoid jitter (#21516)

Hard to write a test for this behavior, this is a micro optimisation which doesn’t change the behavior but only makes it smoother by happening right before async request.
This commit is contained in:
Joffrey JAFFEUX 2023-05-15 08:14:50 +02:00 committed by GitHub
parent 74f01b8cbd
commit c8eb1a275c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -59,5 +59,7 @@ export default class ChatChannelThread extends DiscourseRoute {
return;
}
}
this.chatStateManager.openSidePanel();
}
}

View File

@ -1,9 +1,11 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
export default class ChatChannelThreads extends DiscourseRoute {
@service router;
@service chatChannelThreadListPane;
@service chatStateManager;
beforeModel(transition) {
const channel = this.modelFor("chat.channel");
@ -13,12 +15,16 @@ export default class ChatChannelThreads extends DiscourseRoute {
this.router.transitionTo("chat.channel", ...channel.routeModels);
return;
}
this.chatStateManager.openSidePanel();
}
@action
willTransition() {
willTransition(transition) {
if (transition.targetName !== "chat.channel.thread") {
this.chatChannelThreadListPane.close();
}
}
activate() {
this.chatChannelThreadListPane.open();