Framework rendering fixes

This commit is contained in:
2025-10-20 15:09:16 +02:00
parent 3e0f2fb781
commit b23ef80a5f
4 changed files with 51 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ export const listRef = <T>( parent: HTMLElement, data: T[], name: string, templa
// Yes, I know, really bad performance, etc, but it's not needed for any other use case
// here, other than a full replace of the data (no dynamic updates)
list = data;
console.log( data );
parent.textContent = '';
// Render the list based on template
for ( let i = 0; i < data.length; i++ ) {
@@ -92,6 +92,7 @@ export const listRef = <T>( parent: HTMLElement, data: T[], name: string, templa
if ( !evaluation && rendered[ index ] ) {
// can use ! here, as semantics of program tell us that this index will exist
nodes[ index ]!.remove();
rendered[ index ] = false;
} else if ( evaluation && !rendered[ index ] ) {
currentIndexInChildrenList++;
parent.insertBefore( nodes[ index ]!, children[ currentIndexInChildrenList ]! );