Fix loading state after each species face click
This commit is contained in:
parent
c3cb923b58
commit
580fd79b8c
1 changed files with 10 additions and 1 deletions
|
@ -545,6 +545,11 @@ function ItemPageOutfitPreview({ itemId }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// We don't need to reload this query when preferred species/color change, so
|
||||||
|
// cache their initial values here to use as query arguments.
|
||||||
|
const [initialPreferredSpeciesId] = React.useState(preferredSpeciesId);
|
||||||
|
const [initialPreferredColorId] = React.useState(preferredColorId);
|
||||||
|
|
||||||
// Start by loading the "canonical" pet and item appearance for the outfit
|
// Start by loading the "canonical" pet and item appearance for the outfit
|
||||||
// preview. We'll use this to initialize both the preview and the picker.
|
// preview. We'll use this to initialize both the preview and the picker.
|
||||||
//
|
//
|
||||||
|
@ -600,7 +605,11 @@ function ItemPageOutfitPreview({ itemId }) {
|
||||||
${petAppearanceFragment}
|
${petAppearanceFragment}
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
variables: { itemId, preferredSpeciesId, preferredColorId },
|
variables: {
|
||||||
|
itemId,
|
||||||
|
preferredSpeciesId: initialPreferredSpeciesId,
|
||||||
|
preferredColorId: initialPreferredColorId,
|
||||||
|
},
|
||||||
onCompleted: (data) => {
|
onCompleted: (data) => {
|
||||||
const canonicalBody = data?.item?.canonicalAppearance?.body;
|
const canonicalBody = data?.item?.canonicalAppearance?.body;
|
||||||
const canonicalPetAppearance = canonicalBody?.canonicalAppearance;
|
const canonicalPetAppearance = canonicalBody?.canonicalAppearance;
|
||||||
|
|
Loading…
Reference in a new issue