From e2aeb90b4b1ffb6a93cd092b4d5e62b6a2550bc5 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 20 Jun 2021 12:04:07 -0700 Subject: [PATCH] Oops, fix loading state bug on homepage! Right, when there are zero layers, we shouldn't say we're loading! This is a consequence of the HACK below. If we didn't short-circuit the effect when length == 0, then we would go through and successfully load 0 layers. --- src/app/components/OutfitPreview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/OutfitPreview.js b/src/app/components/OutfitPreview.js index db70539..55508a0 100644 --- a/src/app/components/OutfitPreview.js +++ b/src/app/components/OutfitPreview.js @@ -359,7 +359,7 @@ export function usePreloadLayers(layers) { // NOTE: This condition would need to change if we started loading one at a // time, or if the error case would need to show a partial state! - const loading = loadedLayers !== layers; + const loading = layers.length > 0 && loadedLayers !== layers; React.useEffect(() => { // HACK: Don't clear the preview when we have zero layers, because it