Don't double-invalidate the windowed list

E.g. when the item count changes due to toggling open state of elements
This commit is contained in:
Adomas Venčkauskas 2025-11-14 15:36:00 +02:00
parent 68b9499bc0
commit 155d2ef75e
2 changed files with 11 additions and 6 deletions

View file

@ -63,6 +63,7 @@ module.exports = class {
this.scrollDirection = 0;
this.scrollOffset = 0;
this.overscanCount = 2;
this._invalidating = false;
this._lastItemCount = null;
this._rowOffsets = [[0, 0]];
@ -113,6 +114,8 @@ module.exports = class {
* Rerender items within the scrollbox. Call sparingly
*/
invalidate() {
if (this._invalidating) return;
this._invalidating = true;
// Removes any items out of view and adds the ones not in view
let oldRenderedRows = new Set(this._renderedRows.keys());
this.render();
@ -122,6 +125,7 @@ module.exports = class {
if (!oldRenderedRows.has(index)) continue;
this.rerenderItem(index);
}
this._invalidating = false;
}
/**

View file

@ -60,12 +60,6 @@
padding-inline-end: 4px;
}
&:first-child {
--extra-width: var(--first-column-extra-width, 0px);
// No padding on the first cell since it's done via twisty and indent
padding-inline-start: 0;
}
&:first-child,
&.primary {
display: flex;
@ -522,3 +516,10 @@
}
}
.virtualized-tree {
.cell:first-child {
--extra-width: var(--first-column-extra-width, 0px);
// No padding on the first cell since it's done via twisty and indent
padding-inline-start: 0;
}
}