frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Project view should not preload all tabs

Open rkg-mm opened this issue 1 year ago • 2 comments

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:

  1. The badge with number on the tab name will not be populated, as it relies on the data loaded in the tab
  2. 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:

  1. 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
  2. Instead using the lazy attribute, do a lazy initialize of the table server loading, triggering the first load when the tab gets activated.

Checklist

rkg-mm avatar Dec 02 '23 23:12 rkg-mm

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 avatar Feb 03 '24 20:02 nscuro

@nscuro I fixed the same issue in another PR but still created this enhancement request here, because it provides further optimization possibilities

rkg-mm avatar Feb 04 '24 00:02 rkg-mm