SEED-platform / seed

Standard Energy Efficiency Data (SEED) Platform™ is a web-based application that helps organizations easily manage data on the energy performance of large groups of buildings.
Other
107 stars 55 forks source link

Fix inventory list double refresh on load #4480

Closed perryr16 closed 6 months ago

perryr16 commented 6 months ago

Any background context you want to provide?

Within the inventory_list_controller there are 10 code blocks that call the load_inventory function, and only 4 that are called outside of a modal close.

  1. filterUsingLabels
  2. update_cycle
  3. gridApi.core.on.filterChanged
  4. gridApi.core.on.sortChanged

filterUsingLabels is responsible for the initial page load. If the ui-grid table has existing filters or sorts, their respective functions gridApi.core.on.filterChanged and gridApi.core.on.sortChanged will each be called leading to 3 possible table loads.

What's this PR do?

  1. Combines the .filterChanged and sortChanged into a single call filterOrSortChanged as they use the same code.
  2. On initial load, check for filters or sorts. If they exist, ignore the first call to filterOrSortChanged

How should this be manually tested?

Try to further adjust the table (pinned columns, hidden columns, label filters...) and make sure it still loads only once

What are the relevant tickets?

4308

Screenshots (if appropriate)

nllong commented 6 months ago