magge-faf / faf-moderator-client-develop-modified

magge's modified Mordor makes moderating mischievous members much more majestic.
MIT License
0 stars 2 forks source link

[Bug] TableView index exceeds maxCellCount #67

Closed magge-faf closed 3 weeks ago

magge-faf commented 1 month ago

2024-08-28T18:21:26.019+02:00 INFO 15760 --- [lication Thread] javafx.scene.control : index exceeds maxCellCount. Check size calculations for class javafx.scene.control.TableRow

This happens in the legacy Mordor as well when you scroll down the reports, because the data set is getting larger and larger. It does not break anything, yet. You just jump between reports and have to scroll a bit more. Slightly annoying.

Memo for future me - Read about possible solutions:

magge-faf commented 3 weeks ago

Had some reading session about pagination and lazy loading. Decided for lazy loading aka infinite scrolling, because felt more natural to use for the report view table, and it seems the bug has been resolved.

Needs some further testing, tho, but I can not reproduce the issue anymore, unlike before.

image

magge-faf commented 3 weeks ago

Today I noticed that lazy loading affects the User Management Tab as well, not just the Reports Tab, and it only shows user data when you scroll, which is slightly annoying.

My first instinct to fix this was to introduce a seventh parameter to the buildUserTableView method and determine if the search was triggered by User Search, ignoring lazy loading in that case.

However, there were too many methods that rely on buildUserTableView throughout the code, and I would have had to refactor a lot of legacy code, which does not seem like the right approach.

Asked AI for support, it simply suggested:

if ("userSearchTableView".equals(tableView.getId())) {
            // Populate the entire table without lazy loading when using User Management Tab
        } else {
             // code lazy loading
        }

Have looked for other cases which need to avoid lazy loading, but so far everything seems to work as intended.


Edit: After a final code review before committing, I noticed, that it would make much more sense to switch the statements to avoid any unwanted side effects for other tabs that might rely on the buildUserTableView. So we use only lazy loading for the reportsTab, and everything else is using the legacy code.

        if ("buildModerationReportTableView".equals(tableView.getId())) {
            // Populate the entire table with lazy loading when using buildModerationReportTableView
            // code
        } else {
            tableView.setItems(allData);
        }