Skip to content

Commit

Permalink
add cached dayHeader date reset on clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Zedwag committed Oct 15, 2024
1 parent 346f365 commit ea0f08c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/devextreme/js/__internal/ui/chat/messagelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ class MessageList extends Widget<Properties> {

_clean(): void {
this._messageGroups = [];
this._lastMessageDate = null;

super._clean();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit ea0f08c

Please sign in to comment.