Skip to content

A platform for community discussion. Free, open, simple.

FIX: keeps panel size when changing content (#21698)

Joffrey JAFFEUXbce56d843cba
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.hbs
index 014ee2be0e2..f2edb56d59a 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.hbs
@@ -9,7 +9,7 @@
}}
style={{if
(and this.site.desktopView this.chatStateManager.isFullPageActive)
- this.width
+ this.widthStyle
}}
>
{{yield}}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js b/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js
index b6916fa2336..8c54bf6d798 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-side-panel.js
@@ -12,25 +12,13 @@ export default class ChatSidePanel extends Component {
@service site;
@tracked sidePanel;
+ @tracked widthStyle;
@action
setSidePanel(element) {
this.sidePanel = element;
}
- get width() {
- if (!this.sidePanel) {
- return;
- }
-
- const maxWidth = Math.min(
- this.#maxWidth(this.sidePanel),
- this.chatSidePanelSize.width
- );
-
- return htmlSafe(`width:${maxWidth}px`);
- }
-
@action
didResize(element, size) {
if (this.isDestroying || this.isDestroyed) {
@@ -43,6 +31,7 @@ export default class ChatSidePanel extends Component {
if (mainPanelWidth > MIN_CHAT_CHANNEL_WIDTH) {
this.chatSidePanelSize.width = size.width;
element.style.width = size.width + "px";
+ this.widthStyle = htmlSafe(`width:${size.width}px`);
}
}