skip OutfitStateItems query if there are no items
Kinda surprised our cache redirect isn't good enough for this, but I guess Apollo can't differentiate between a confident empty list vs an uncertain empty list!
This commit is contained in:
parent
b47392f17f
commit
94b05ad95b
1 changed files with 9 additions and 2 deletions
|
@ -25,7 +25,11 @@ function useOutfitState() {
|
|||
const allItemIds = [...state.wornItemIds, ...state.closetedItemIds];
|
||||
const { loading, error, data } = useQuery(
|
||||
gql`
|
||||
query OutfitState($allItemIds: [ID!]!, $speciesId: ID!, $colorId: ID!) {
|
||||
query OutfitStateItems(
|
||||
$allItemIds: [ID!]!
|
||||
$speciesId: ID!
|
||||
$colorId: ID!
|
||||
) {
|
||||
items(ids: $allItemIds) {
|
||||
# TODO: De-dupe this from SearchPanel?
|
||||
id
|
||||
|
@ -49,7 +53,10 @@ function useOutfitState() {
|
|||
}
|
||||
${itemAppearanceFragment}
|
||||
`,
|
||||
{ variables: { allItemIds, speciesId, colorId } }
|
||||
{
|
||||
variables: { allItemIds, speciesId, colorId },
|
||||
skip: allItemIds.length === 0,
|
||||
}
|
||||
);
|
||||
|
||||
const items = (data && data.items) || [];
|
||||
|
|
Loading…
Reference in a new issue