Skip to content

Commit 09de0ec

Browse files
committed
Add keyed to listItems when rowStyles changes
1 parent 807a578 commit 09de0ec

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

packages/design-system/src/elements/toniq-list-table/toniq-list-table.element.ts

+16-12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
css,
1515
defineElementEvent,
1616
html,
17+
keyed,
1718
listen,
1819
nothing,
1920
onResize,
@@ -379,11 +380,9 @@ export const ToniqListTable = defineToniqElement<ListTableInputs>()({
379380
function tableUpdate() {
380381
const container = host.shadowRoot.querySelector('.table-list') as HTMLElement;
381382
if (container instanceof HTMLElement) {
382-
requestAnimationFrame(() => {
383-
updateState({
384-
canScroll: container.scrollWidth > container.clientWidth,
385-
tableListLeft: container.getBoundingClientRect().left,
386-
});
383+
updateState({
384+
canScroll: container.scrollWidth > container.clientWidth,
385+
tableListLeft: container.getBoundingClientRect().left,
387386
});
388387
}
389388
}
@@ -545,7 +544,9 @@ export const ToniqListTable = defineToniqElement<ListTableInputs>()({
545544
updateRowItems();
546545
})}
547546
${listen('scroll', () => {
548-
tableUpdate();
547+
requestAnimationFrame(() => {
548+
tableUpdate();
549+
});
549550
})}
550551
${listen('keydown', (event) => {
551552
if (inputs.showLoading) {
@@ -554,12 +555,15 @@ export const ToniqListTable = defineToniqElement<ListTableInputs>()({
554555
}
555556
})}
556557
>
557-
${repeat(
558-
rows,
559-
(item) => item,
560-
(item: ListTableRow<any>, index: number) => {
561-
return listItem(item, index);
562-
},
558+
${keyed(
559+
state.rowStyles,
560+
repeat(
561+
rows,
562+
(item) => item,
563+
(item: ListTableRow<any>, index: number) => {
564+
return listItem(item, index);
565+
},
566+
),
563567
)}
564568
${renderIf(
565569
state.canScroll,

0 commit comments

Comments
 (0)