Fix crash when using old tab to load item page

Oops, the new `canonicalAppearance` arguments couldn't handle being omitted rather than being null, due to a low-level SQL call site that cares about the difference.

This meant that loading an item page in an old tab, with an old copy of our JS, could cause a crash.

Now, the backend will be okay with queries from old pages, and respond the same as before!

This isn't a huge deal, because once everyone is on the new JS we won't send queries without this parameter anyway… but I like my optional arguments to actually BE optional, without surprises lurking >.>
This commit is contained in:
Emi Matchu 2021-02-03 15:51:49 -08:00
parent 8970b6af26
commit f3e19158d0

View file

@ -1005,7 +1005,12 @@ const buildCanonicalPetStateForBodyLoader = (db, loaders) =>
LIMIT 1`,
nestTables: true,
},
[bodyId, preferredColorId, fallbackColorId, gender === "fem"]
[
bodyId,
preferredColorId || "<ignore>",
fallbackColorId,
gender === "fem",
]
);
const petState = normalizeRow(rows[0].pet_states);
const petType = normalizeRow(rows[0].pet_types);