From 5d827bc78d35de5408b31c618954d9501e2f121c Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 1 Feb 2021 18:05:29 -0800 Subject: [PATCH] Disable species/color picker while item page loads Ok I think I've finally narrowed this bug down! We had one more loading case: the items page needs time to figure out which species/color to default the fields to, and passes null into the component while this loads. Now, we wait for that! --- src/app/components/SpeciesColorPicker.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/components/SpeciesColorPicker.js b/src/app/components/SpeciesColorPicker.js index 4d10a54..cfe8fee 100644 --- a/src/app/components/SpeciesColorPicker.js +++ b/src/app/components/SpeciesColorPicker.js @@ -179,8 +179,11 @@ function SpeciesColorPicker({ aria-label="Pet color" value={colorId} // We also wait for the valid pairs before enabling, so users can't - // trigger change events we're not ready for. - isLoading={allColors.length === 0 || loadingValids} + // trigger change events we're not ready for. Also, if the caller + // hasn't provided species and color yet, assume it's still loading. + isLoading={ + allColors.length === 0 || loadingValids || !speciesId || !colorId + } isDisabled={isDisabled} onChange={onChangeColor} size={size}