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!
This commit is contained in:
Emi Matchu 2021-02-01 18:05:29 -08:00
parent be7401d62a
commit 5d827bc78d

View file

@ -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}