Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Fix resource
Browse files Browse the repository at this point in the history
Fix resource.
  • Loading branch information
abuccts committed Aug 19, 2020
1 parent 744d1fd commit 289d299
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,24 @@ export const HivedSkuSection = React.memo(props => {
[hivedSkuTypes],
);

const _setSku = () => {
if (value.skuType != null) {
const selected = skuOptions.find(option => option.key === value.skuType);
if (selected == null) {
onChange({ ...value, skuType: null, sku: null });
} else if (value.sku == null) {
const sku = get(selected, 'sku', null);
onChange({ ...value, sku });
}
}
};

const _onSkuNumChange = useCallback(
num => {
const hivedSku = { ...value, skuNum: num };
if (hivedSku.skuType != null && hivedSku.sku == null) {
hivedSku.sku = get(
skuOptions.find(option => option.key === hivedSku.skuType),
'sku',
null,
);
}
onChange(hivedSku);
onChange({
...value,
skuNum: num,
});
},
[onChange],
);
Expand All @@ -58,6 +65,7 @@ export const HivedSkuSection = React.memo(props => {
[onChange],
);

_setSku();
return (
<BasicSection
sectionLabel='Resources SKU'
Expand Down

0 comments on commit 289d299

Please sign in to comment.