show error message when preload can't build movies

Not sure why movie clip building is failing! But it happened outside our try-catch, so it left us in an infinite spinner state.

The repro item is the Spring Topiary Garden Background!
This commit is contained in:
Emi Matchu 2020-10-22 23:52:26 -07:00
parent 9f692b02b8
commit 0387a78574

View file

@ -340,13 +340,24 @@ export function usePreloadLayers(layers) {
if (canceled) return;
const newLayersHaveAnimations = assets.some(
(a) =>
a.type === "movie" &&
hasAnimations(buildMovieClip(a.library, a.libraryUrl))
);
let movieClips;
try {
movieClips = assets
.filter((a) => a.type === "movie")
.map((a) => buildMovieClip(a.library, a.libraryUrl));
} catch (e) {
console.error("Error building movie clips", e);
assetPromises.forEach((p) => {
if (p.cancel) {
p.cancel();
}
});
setError(e);
return;
}
setLayersHaveAnimations(movieClips.some(hasAnimations));
setLoadedLayers(layers);
setLayersHaveAnimations(newLayersHaveAnimations);
};
loadAssets();