FIX: ensure sidepanel size is correctly applied when showing (#21701)

We were not correctly setting the widthStyle on insert.

Note this commit also changes throttling from 24ms to 50ms. 24ms was probably overkill.
This commit is contained in:
Joffrey JAFFEUX 2023-05-23 20:13:58 +02:00 committed by GitHub
parent c908eeacc9
commit 68364461f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,7 @@
{{#if this.chatStateManager.isSidePanelExpanded}}
<div
class="chat-side-panel"
{{did-insert this.setSidePanel}}
{{did-insert this.setupSize}}
{{chat/resizable-node
".chat-side-panel-resizer"
this.didResize

View File

@ -11,12 +11,11 @@ export default class ChatSidePanel extends Component {
@service chatSidePanelSize;
@service site;
@tracked sidePanel;
@tracked widthStyle;
@action
setSidePanel(element) {
this.sidePanel = element;
setupSize() {
this.widthStyle = htmlSafe(`width:${this.chatSidePanelSize.width}px`);
}
@action
@ -28,7 +27,7 @@ export default class ChatSidePanel extends Component {
const parentWidth = element.parentElement.getBoundingClientRect().width;
const mainPanelWidth = parentWidth - size.width;
if (mainPanelWidth > MIN_CHAT_CHANNEL_WIDTH) {
if (mainPanelWidth >= MIN_CHAT_CHANNEL_WIDTH) {
this.chatSidePanelSize.width = size.width;
element.style.width = size.width + "px";
this.widthStyle = htmlSafe(`width:${size.width}px`);

View File

@ -68,7 +68,7 @@ export default class ResizableNode extends Modifier {
@bind
_resize(event) {
throttle(this, this._resizeThrottled, event, 24);
throttle(this, this._resizeThrottled, event, 50);
}
/*