Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit fe9d56f

Browse files
authored
fix: Row Detail open/close multiple times should always re-render (#1349)
1 parent 66b4592 commit fe9d56f

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

packages/aurelia-slickgrid/src/extensions/slickRowDetailView.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,14 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
137137
this._preloadController?.dispose();
138138

139139
// triggers after backend called "onAsyncResponse.notify()"
140-
await this.renderViewModel(args?.item);
141-
142-
if (typeof this.rowDetailViewOptions?.onAsyncEndUpdate === 'function') {
143-
this.rowDetailViewOptions.onAsyncEndUpdate(event, args);
144-
}
140+
// because of the preload destroy above, we need a small delay to make sure the DOM element is ready to render the Row Detail
141+
queueMicrotask(async () => {
142+
await this.renderViewModel(args?.item);
143+
144+
if (typeof this.rowDetailViewOptions?.onAsyncEndUpdate === 'function') {
145+
this.rowDetailViewOptions.onAsyncEndUpdate(event, args);
146+
}
147+
});
145148
});
146149

147150
this._eventHandler.subscribe(this.onAfterRowDetailToggle, async (event, args) => {

test/cypress/e2e/example19.cy.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,21 @@ describe('Example 19 - Row Detail View', () => {
346346
.find('.slick-cell + .dynamic-cell-detail .innerDetailView_101')
347347
.should('not.exist');
348348
});
349+
350+
it('should expect the Row Detail to be re-rendered after expanding/collapsing multiple times', () => {
351+
cy.get('#grid19').find('.slick-row:nth(1) .slick-cell:nth(0)').as('toggle1');
352+
cy.get('@toggle1').click();
353+
cy.get('@toggle1').click();
354+
cy.get('@toggle1').click();
355+
356+
cy.get('#grid19').find('.slick-cell + .dynamic-cell-detail .innerDetailView_1').as('detailContainer');
357+
cy.get('@detailContainer').find('h3').contains('Task 1');
358+
359+
cy.get('@toggle1').click();
360+
cy.get('@detailContainer').should('not.exist');
361+
362+
cy.get('@toggle1').click();
363+
cy.get('#grid19').find('.slick-cell + .dynamic-cell-detail .innerDetailView_1').as('detailContainer');
364+
cy.get('@detailContainer').find('h3').contains('Task 1');
365+
});
349366
});

0 commit comments

Comments
 (0)