From 612cf914e0e65acd24212d7ead189758139af142 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Thu, 1 Feb 2024 08:55:42 -0800 Subject: [PATCH] Skip rendering layers without a usable image This happens on the Baby Kougra, where for most poses half of the assets have a manifest that includes an SVG but no PNG. Skip 'em! I considered adding a glitch tag for this, but idk I think we can do that once we're aware of an actual case where this causes visible issues. --- .../wardrobe-2020/components/OutfitPreview.js | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/app/javascript/wardrobe-2020/components/OutfitPreview.js b/app/javascript/wardrobe-2020/components/OutfitPreview.js index 9a781420..2e138025 100644 --- a/app/javascript/wardrobe-2020/components/OutfitPreview.js +++ b/app/javascript/wardrobe-2020/components/OutfitPreview.js @@ -215,6 +215,10 @@ export function OutfitLayers({ return () => window.removeEventListener("resize", computeAndSaveCanvasSize); }, [setCanvasSize]); + const layersWithAssets = visibleLayers.filter((l) => + layerHasUsableAssets(l, { hiResMode }), + ); + return ( {({ css }) => ( @@ -247,7 +251,7 @@ export function OutfitLayers({ )} - {visibleLayers.map((layer) => ( + {layersWithAssets.map((layer) => (