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

Before this commit the following actions would have shown the issue:
- visit a thread
- changes the width of the side panel
- open threads list
- the size has reverted to previous state

This was caused by the width change to not correctly be tracked.
This commit is contained in:
Joffrey JAFFEUX 2023-05-23 18:29:12 +02:00 committed by GitHub
parent c543a3207d
commit bce56d843c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 14 deletions

View File

@ -9,7 +9,7 @@
}}
style={{if
(and this.site.desktopView this.chatStateManager.isFullPageActive)
this.width
this.widthStyle
}}
>
{{yield}}

View File

@ -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`);
}
}