NASA-AMMOS / aerie-ui

The client application for Aerie.
https://nasa-ammos.github.io/aerie-docs/
MIT License
29 stars 5 forks source link

Refactor resourcesByViewLayerId to reduce unnecessary re-rendering of timeline elements #1069

Closed AaronPlave closed 6 months ago

AaronPlave commented 8 months ago

From https://github.com/NASA-AMMOS/aerie-ui/pull/1056#issuecomment-1864772807

Not strictly related to this PR but this processResourcesToLinePoints functionality runs whenever the view changes even though the resources have not fundamentally changed. This happens on both develop and on this branch. So if we could sort that out this processing of resources to line points would only be running once really.

Edit: Looks like this happens because resources are stored in that resourcesByViewLayerId map which will be recreated every time the view changes. Wonder if we could either cache this computation based off a sim dataset id (kind of ugly to pass that all the way down to LayerLine). Perhaps another more involved solution could be refactoring resourcesByViewLayerId usage to just compute it on the fly instead of tying all of these different entities like: Row, RowHeader, RowYAxes, etc to this store. May help us reduce unnecessary re-rendering on the timeline though would need to make sure this would actually work in practice.