Skip to content

Table: improve tile mode#2102

Open
fschinkel wants to merge 1 commit intofeatures/fschinkel/26.2/hybrid-manager-dispose-widgetsfrom
features/fschinkel/26.2/configured-tiles
Open

Table: improve tile mode#2102
fschinkel wants to merge 1 commit intofeatures/fschinkel/26.2/hybrid-manager-dispose-widgetsfrom
features/fschinkel/26.2/configured-tiles

Conversation

@fschinkel
Copy link
Copy Markdown
Member

There may not always be a tile for a row. Therefore, implement Table.createTiles more lenient in order to avoid null pointer exceptions. In addition, the TableTileGridMediator ensures that null values removed from its list of tiles.
The list of tiles of the TableTileGridMediator needs to be unique as the tiles will be rendered one after another. If there are duplicates in the list of tiles an 'Already rendered'-error will be thrown if the second occurrence is rendered. Therefore, the TableTileGridMediator removes all duplicates from its list of tiles.

379008

@fschinkel fschinkel requested a review from cguglielmo March 17, 2026 15:53
@fschinkel fschinkel self-assigned this Mar 17, 2026
@fschinkel fschinkel force-pushed the features/fschinkel/26.2/hybrid-manager-dispose-widgets branch from 411586d to c572753 Compare March 18, 2026 10:36
@fschinkel fschinkel force-pushed the features/fschinkel/26.2/configured-tiles branch from f59e969 to 4d1fb9b Compare March 18, 2026 10:38
@fschinkel fschinkel force-pushed the features/fschinkel/26.2/hybrid-manager-dispose-widgets branch from c572753 to a8d6765 Compare March 23, 2026 05:45
There may not always be a tile for a row. Therefore, implement
Table.createTiles more lenient in order to avoid null pointer
exceptions. In addition, the TableTileGridMediator ensures that null
values removed from its list of tiles.
The list of tiles of the TableTileGridMediator needs to be unique as the
tiles will be rendered one after another. If there are duplicates in the
list of tiles an 'Already rendered'-error will be thrown if the second
occurrence is rendered. Therefore, the TableTileGridMediator removes all
duplicates from its list of tiles.

379008
@fschinkel fschinkel force-pushed the features/fschinkel/26.2/configured-tiles branch from 4d1fb9b to cd9afd0 Compare March 23, 2026 05:49
Copy link
Copy Markdown
Member

@cguglielmo cguglielmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in the commit message:

ensures that null values are removed from its list of tiles.


setTiles(tiles: ObjectOrChildModel<Tile>[]) {
tiles = arrays.ensure(tiles)
.filter((value, index, array) => value && array.indexOf(value) === index); // remove duplicates
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is O(n^2), using a Set should be faster: [...new Set(tiles)]

return;
}
this.tiles = this.table.rows.map(row => this.tilesMap[row.id]);
this.tiles = this.table.rows.map(row => this.tilesMap[row.id])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants