[WIP] Fix bug loading movies

This was a fun journey! Turns out Next 12 is using a new faster JS compiler called SWC, which had a compiler bug that triggered here!

The incorrect looping behavior caused `libraryUrl` to sometimes be `null` by the time the movie promise completes, because `layer` was set to whatever the `last` layer in the list had been. https://github.com/swc-project/swc/issues/2624

Anyway, turns out this code has been through a few refactors, and the `async` function wrapper is extraneous now! So I've just deleted it and inlined its code. Ta da! lol
This commit is contained in:
Emi Matchu 2021-11-02 00:11:23 -07:00
parent 4af2719098
commit 7fd85e5e2a

View file

@ -388,7 +388,6 @@ export function usePreloadLayers(layers) {
setError(null);
setLayersHaveAnimations(false);
const loadAssets = async () => {
const minimalAssetPromises = [];
const imageAssetPromises = [];
const movieAssetPromises = [];
@ -462,9 +461,6 @@ export function usePreloadLayers(layers) {
console.error(`Error preloading movie library ${p.libraryUrl}:`, e);
})
);
};
loadAssets();
return () => {
canceled = true;