mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
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:
parent
74f01b8cbd
commit
c8eb1a275c
@ -59,5 +59,7 @@ export default class ChatChannelThread extends DiscourseRoute {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.chatStateManager.openSidePanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
|
||||||
export default class ChatChannelThreads extends DiscourseRoute {
|
export default class ChatChannelThreads extends DiscourseRoute {
|
||||||
@service router;
|
@service router;
|
||||||
@service chatChannelThreadListPane;
|
@service chatChannelThreadListPane;
|
||||||
|
@service chatStateManager;
|
||||||
|
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
const channel = this.modelFor("chat.channel");
|
const channel = this.modelFor("chat.channel");
|
||||||
@ -13,12 +15,16 @@ export default class ChatChannelThreads extends DiscourseRoute {
|
|||||||
this.router.transitionTo("chat.channel", ...channel.routeModels);
|
this.router.transitionTo("chat.channel", ...channel.routeModels);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.chatStateManager.openSidePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
willTransition() {
|
willTransition(transition) {
|
||||||
|
if (transition.targetName !== "chat.channel.thread") {
|
||||||
this.chatChannelThreadListPane.close();
|
this.chatChannelThreadListPane.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.chatChannelThreadListPane.open();
|
this.chatChannelThreadListPane.open();
|
||||||
|
Loading…
Reference in New Issue
Block a user