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.
This commit is contained in:
Emi Matchu 2023-10-24 14:48:55 -07:00
parent 53deee85dd
commit a2594d1797

View file

@ -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);