diff --git a/packages/devextreme/js/__internal/ui/chat/messagelist.ts b/packages/devextreme/js/__internal/ui/chat/messagelist.ts index e9c0b2eb10ce..549ac4bd8434 100644 --- a/packages/devextreme/js/__internal/ui/chat/messagelist.ts +++ b/packages/devextreme/js/__internal/ui/chat/messagelist.ts @@ -373,6 +373,7 @@ class MessageList extends Widget { _clean(): void { this._messageGroups = []; + this._lastMessageDate = null; super._clean(); } diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/messageList.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/messageList.tests.js index 721908b524a1..aedaa33de593 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/messageList.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/messageList.tests.js @@ -346,6 +346,27 @@ QUnit.module('MessageList', moduleConfig, () => { assert.strictEqual($dayHeaders.length, 1, 'only one day header was added'); }); + + QUnit.test('Day header should not dissapear after component invalidate', function(assert) { + const items = [{ + timestamp: new Date('11.10.2024'), + text: 'ABC', + }]; + + this.reinit({ + items, + }); + + let $dayHeaders = this.getDayHeaders(); + + assert.strictEqual($dayHeaders.length, 1, 'day header was aaded'); + + this.instance.option({ items }); + + $dayHeaders = this.getDayHeaders(); + + assert.strictEqual($dayHeaders.length, 1, 'day header is not removed after invalidate'); + }); }); QUnit.module('MessageGroup integration', () => {