From 3bcb8f694a4c702f760855f922612beda5d8b33d Mon Sep 17 00:00:00 2001 From: EugeniyKiyashko Date: Thu, 26 Sep 2024 13:41:18 +0400 Subject: [PATCH] refactor --- ...mited dimensions (material-blue-light).png | Bin 15509 -> 15509 bytes .../js/__internal/ui/chat/messagelist.ts | 19 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/e2e/testcafe-devextreme/tests/chat/etalons/Messagelist empty with limited dimensions (material-blue-light).png b/e2e/testcafe-devextreme/tests/chat/etalons/Messagelist empty with limited dimensions (material-blue-light).png index fc688a2aa3aa4f8952ffc7f00f367566b48d2bed..13ea309d6c71a43fd4dd9df554c7c567053956e1 100644 GIT binary patch delta 56 zcmbPQIkj@b9LCKj7^i7ZzMv~O`GBtU<~Ut(E*4jl+^L%@%{f>_ZZk#x;%Z!TlK}`k MUHx3vIVCg!0Cx=(cK`qY delta 71 zcmbPQIkj@b97ZuG0hWW#DlCoyHZDla&25Zpv^U4;igU4SF72Pbxze12Riw`|@>kbf R!wd!>@O1TaS?83{1OOW>7Dxa9 diff --git a/packages/devextreme/js/__internal/ui/chat/messagelist.ts b/packages/devextreme/js/__internal/ui/chat/messagelist.ts index 1c2fc3013004..f467968a5b6a 100644 --- a/packages/devextreme/js/__internal/ui/chat/messagelist.ts +++ b/packages/devextreme/js/__internal/ui/chat/messagelist.ts @@ -1,4 +1,3 @@ -import { cancelAnimationFrame, requestAnimationFrame } from '@js/animation/frame'; import domAdapter from '@js/core/dom_adapter'; import type { dxElementWrapper } from '@js/core/renderer'; import $ from '@js/core/renderer'; @@ -37,7 +36,7 @@ class MessageList extends Widget { private _containerClientHeight = 0; - private _shouldSkipContainerResize?: boolean; + private _suppressResizeHandling?: boolean; private _scrollable!: Scrollable; @@ -66,7 +65,7 @@ class MessageList extends Widget { this._attachResizeObserverSubscription(); - this._shouldSkipContainerResize = true; + this._suppressResizeHandling = true; } _attachResizeObserverSubscription(): void { @@ -83,16 +82,16 @@ class MessageList extends Widget { } _resizeHandler({ contentRect, target }: ResizeObserverEntry): void { - if (this._shouldSkipContainerResize + const newHeight = contentRect.height; + + if (this._suppressResizeHandling && this._isAttached(target) && isElementVisible(target as HTMLElement) ) { this._scrollContentToLastMessage(); - this._containerClientHeight = target.clientHeight; - this._shouldSkipContainerResize = false; + this._suppressResizeHandling = false; } else { - const newHeight = contentRect.height; const heightChange = this._containerClientHeight - newHeight; let { scrollTop } = target; @@ -102,9 +101,9 @@ class MessageList extends Widget { } this._scrollable.scrollTo({ top: scrollTop }); - - this._containerClientHeight = newHeight; } + + this._containerClientHeight = newHeight; } _renderEmptyViewContent(): void { @@ -168,7 +167,9 @@ class MessageList extends Widget { .appendTo(this.$element()); this._scrollable = this._createComponent($scrollable, Scrollable, { + // useNative: false, useKeyboard: false, + // showScrollbar: 'always', bounceEnabled: false, }); }