From a2594d1797f0906600d75fa6aa38dba82fd0b073 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 24 Oct 2023 14:48:55 -0700 Subject: [PATCH] Fix crash on user lists page from orphaned hangers If you delete a closet list without deleting the items in it, it'll dump them into your default own/want lists. This isn't necessarily the behavior we really want, but oh well, that's the truth right now! The GraphQL endpoint was assuming that all hanger `list_id` values were valid, oops! Now, we ignore list IDs that don't match a list. --- src/server/types/User.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/types/User.js b/src/server/types/User.js index cf1a7e8..caa318f 100644 --- a/src/server/types/User.js +++ b/src/server/types/User.js @@ -238,7 +238,7 @@ const resolvers = { const defaultListOwnedHangers = []; const defaultListWantedHangers = []; for (const hanger of allClosetHangers) { - if (hanger.listId) { + if (hanger.listId && hangersByList.has(hanger.listId)) { hangersByList.get(hanger.listId).push(hanger); } else if (hanger.owned) { defaultListOwnedHangers.push(hanger);