Fix performance problem with defaulting to []

This commit is contained in:
Emi Matchu 2021-02-10 13:51:59 -08:00
parent bbb752fa65
commit d2c672667d

View file

@ -88,7 +88,7 @@ export default function useOutfitAppearance(outfitState) {
); );
const petAppearance = data1?.petAppearance; const petAppearance = data1?.petAppearance;
const items = data2?.items || []; const items = data2?.items;
const itemAppearances = React.useMemo( const itemAppearances = React.useMemo(
() => (items || []).map((i) => i.appearance), () => (items || []).map((i) => i.appearance),
[items] [items]
@ -104,7 +104,7 @@ export default function useOutfitAppearance(outfitState) {
loading: loading1 || loading2, loading: loading1 || loading2,
error: error1 || error2, error: error1 || error2,
petAppearance, petAppearance,
items, items: items || [],
itemAppearances, itemAppearances,
visibleLayers, visibleLayers,
bodyId, bodyId,