This PR improves resource loading performance by moving resource fetching into the Row component and only loading resources found within the view. The Row component now fetches all of the resources needed for the Row's layers. The Row also tracks and displays loading and error states. One caveat is that all external resources are still globally fetched since there is not currently a good mechanism for detecting changes in individual external resources (for normal resources we key off simulation ID) though maybe @Mythicaeda or @mattdailis would have some ideas.
Notes:
At first I attempted to create a global resource store that managed resource fetching, states, etc., but that proved to be quite complex due to all of the inputs that are necessary to drive resource fetching for the current sim.
I also tried to implement resource fetching at the Timeline level but it grew fairly complex with a lot of interdependent reactive variables and stores and caused a lot of unnecessary re-rendering in child components.
I thought about some sort of custom store for resource fetching and states which may be possible but somewhat complex? Curious if @duranb has any thoughts on how this might be done.
Since this PR has resource fetching occurring at the Row level it means that resources are not available outside of Rows which is fine except that the Timeline Editor needs access to resources in order to compute y axes and place horizontal guides. To work around this, I have the Row component reflecting the computed y axes into a store which is then read by the editor. This could also be done for resources if needed in the future though it is probably not great from a data flow and ownership perspective.
External resources store is directly accessed by Row in this PR instead of passing it down from TimelinePanel -> Timeline -> Row. Is there any reason to not directly access stores like this? Seems like in some cases direct access would be better since it would not cause re-rendering of parent components that are just passing things through?
Closes #1124, closes #1069
This PR improves resource loading performance by moving resource fetching into the Row component and only loading resources found within the view. The Row component now fetches all of the resources needed for the Row's layers. The Row also tracks and displays loading and error states. One caveat is that all external resources are still globally fetched since there is not currently a good mechanism for detecting changes in individual external resources (for normal resources we key off simulation ID) though maybe @Mythicaeda or @mattdailis would have some ideas.
Notes: