frontend
frontend copied to clipboard
Project view should not preload all tabs
Current Behavior
When opening a project, all tables in all tabs are auto-loaded directly, causing some delay in the UI and unnecessary load on the server. The loaded data is used to also populate the number on the tab-badge, so just making tabs lazy will have side effects.
Proposed Behavior
Tabs should be loaded only when being opened.
This could be done by applying the lazy attribute, to the tab, but that has 2 drawbacks:
- The badge with number on the tab name will not be populated, as it relies on the data loaded in the tab
- whenever you switch between tabs, the old tab content gets discarded, causing multiple loads again which would not be necessary
Possible solution to both problems:
- Check if the data required for tab-badge-numbers is available e.g. in the project object, or if it could be loaded in a single additional call e.g. loading a metrics object
- Instead using the lazy attribute, do a lazy initialize of the table server loading, triggering the first load when the tab gets activated.
Checklist
- [X] I have read and understand the contributing guidelines
- [X] I have checked the existing issues for whether this enhancement was already requested
FYI slow page loads were amplified by each table's content being loaded more than once. This happened because application of user preferences for column visibility silently triggered a reload of each table. This is now fixed with https://github.com/DependencyTrack/frontend/pull/727.
@nscuro I fixed the same issue in another PR but still created this enhancement request here, because it provides further optimization possibilities