For example, when the src
attribute of a <lume-gltf-model>
element changes, the previous network request (if any) is currently simply ignored but not canceled, then a new network request for the new src is created, meaning that multiple network requests will be happening at the same time. If you change the src
attribute 5 times before models were loaded, then up to 5 network requests will be happening in parallel while 4 of those will be ignored (and any results garbage collected).
Instead, we should cancel any previous network requests rather than simply ignoring them.
But in order to do this, we first need to add this ability to Three.js which abstracts away the network requests behind its API and the only way to "cancel" a loader is to ignore its result (hence the network requests are ignored).