mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: do not reload identical route in drawer (#27992)
This is a performance optimisation to prevent the same route to keep reloading the same endpoint. No tests as it's not changing behavior and is also quite complex to test efficiently.
This commit is contained in:
parent
346c9116b5
commit
8b18fd1556
@ -34,6 +34,10 @@ export default class ChatRoute extends DiscourseRoute {
|
||||
) {
|
||||
transition.abort();
|
||||
|
||||
if (this.chatDrawerRouter.currentRouteName === transition.targetName) {
|
||||
return;
|
||||
}
|
||||
|
||||
let url = transition.intent.url;
|
||||
if (transition.targetName.startsWith("chat.channel")) {
|
||||
url ??= this.router.urlFor(
|
||||
|
@ -146,6 +146,7 @@ export default class ChatDrawerRouter extends Service {
|
||||
this.drawerRoute = ROUTES[route.name];
|
||||
this.params = this.drawerRoute?.extractParams?.(route) || route.params;
|
||||
this.component = this.drawerRoute?.name || ChatDrawerRoutesChannels;
|
||||
this.currentRouteName = route.name;
|
||||
|
||||
this.drawerRoute.activate?.(route);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ export default class ChatStateManager extends Service {
|
||||
@service chatHistory;
|
||||
@service router;
|
||||
@service site;
|
||||
@service chatDrawerRouter;
|
||||
|
||||
@tracked isSidePanelExpanded = false;
|
||||
@tracked isDrawerExpanded = false;
|
||||
@ -118,6 +119,7 @@ export default class ChatStateManager extends Service {
|
||||
}
|
||||
});
|
||||
|
||||
this.chatDrawerRouter.currentRouteName = null;
|
||||
this.isDrawerActive = false;
|
||||
this.isDrawerExpanded = false;
|
||||
this.chat.updatePresence();
|
||||
|
Loading…
Reference in New Issue
Block a user