From fb51eeec5bd00a7377d99051d67448d577f08941 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 1 Aug 2020 15:43:50 -0700 Subject: [PATCH] switch radio away from all pets after using picker I think it's more helpful to auto-switch: if you're using the species/color picker for pet compatibility, that's probably what you want! And it's all buffered behind the Save Changes button anyway, so nbd to play a bit fast and loose! --- .../support/ItemSupportAppearanceLayerModal.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/WardrobePage/support/ItemSupportAppearanceLayerModal.js b/src/app/WardrobePage/support/ItemSupportAppearanceLayerModal.js index 1afafd9..2c022fd 100644 --- a/src/app/WardrobePage/support/ItemSupportAppearanceLayerModal.js +++ b/src/app/WardrobePage/support/ItemSupportAppearanceLayerModal.js @@ -226,10 +226,14 @@ function ItemSupportAppearanceLayerPetCompatibility({ const biologyLayers = visibleLayers.filter((l) => l.source === "pet"); - // When the appearance body ID changes, select it as the new body ID. (This - // is an effect because it happens after the appearance finishes loading!) + // After we touch a species/color selector and null out `bodyId`, when the + // appearance body ID loads in, select it as the new body ID. + // + // This might move the radio button away from "all pets", but I think that's + // a _less_ surprising experience: if you're touching the pickers, then + // that's probably where you head is. React.useEffect(() => { - if (selectedBodyId !== "0") { + if (selectedBodyId == null && appearanceBodyId != null) { onChangeBodyId(appearanceBodyId); } }, [selectedBodyId, appearanceBodyId, onChangeBodyId]); @@ -289,6 +293,10 @@ function ItemSupportAppearanceLayerPetCompatibility({ setSelectedBiology({ speciesId, colorId, isValid, pose }); if (isValid) { onChangePreviewBiology({ speciesId, colorId, isValid, pose }); + + // Also temporarily null out the body ID. We'll switch to the new + // body ID once it's loaded. + onChangeBodyId(null); } }} />