From 77568c7a2ff45cab7833ea8a42c894f5ee208960 Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Sat, 25 Apr 2020 04:38:55 -0700 Subject: [PATCH] graceful handling of items that don't fit the pet --- dev-todos.txt | 1 + src/server/index.js | 4 ++++ src/useOutfitState.js | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/dev-todos.txt b/dev-todos.txt index 68cfe5e..1c2e865 100644 --- a/dev-todos.txt +++ b/dev-todos.txt @@ -2,3 +2,4 @@ * Use react-virtualized instead of our own scroller, but we need total count known, and we need another solution for the CSS transitions in the outfit case * Restore good download behavior: use crossOrigin for everything, and remove cache-buster in the URL we use for canvas * Undo the local linking we did for @chakra-ui/core, react, and react-dom on Matchu's machine 😅 +* Present invalidated items somewhere on the screen, instead of them just vanishing? :/ diff --git a/src/server/index.js b/src/server/index.js index 1981b7b..e9f56a9 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -96,6 +96,10 @@ const resolvers = { bodyId: petType.bodyId, }); + if (swfAssets.length === 0) { + return null; + } + const restrictedZones = []; for (const [i, bit] of Array.from(item.zonesRestrict).entries()) { if (bit === "1") { diff --git a/src/useOutfitState.js b/src/useOutfitState.js index 21aa504..d15242f 100644 --- a/src/useOutfitState.js +++ b/src/useOutfitState.js @@ -210,6 +210,10 @@ function getZonesAndItems(itemsById, wornItemIds, closetedItemIds) { const allItems = [...wornItems, ...closetedItems]; const itemsByZoneLabel = new Map(); for (const item of allItems) { + if (!item.appearanceOn) { + continue; + } + for (const layer of item.appearanceOn.layers) { const zoneLabel = layer.zone.label;