diff --git a/CHANGELOG.md b/CHANGELOG.md index ed00b149e..8d23e571a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#944](https://github.com/alleslabs/celatone-frontend/pull/944) Fix asset input - [#941](https://github.com/alleslabs/celatone-frontend/pull/941) Fix contract interaction routing - [#936](https://github.com/alleslabs/celatone-frontend/pull/936) Fix mobile search not focusable - [#931](https://github.com/alleslabs/celatone-frontend/pull/931) Fix minor module related ui diff --git a/src/lib/components/forms/AssetInput.tsx b/src/lib/components/forms/AssetInput.tsx index c2a48cf03..6e0ccd92a 100644 --- a/src/lib/components/forms/AssetInput.tsx +++ b/src/lib/components/forms/AssetInput.tsx @@ -16,7 +16,7 @@ interface AssetInputProps { setCurrencyValue: (newVal: string) => void; amountInput: JSX.Element; assetOptions: AssetOptions[]; - initialSelected: string; + initialSelected?: string; labelBgColor?: string; } diff --git a/src/lib/components/forms/SelectInput.tsx b/src/lib/components/forms/SelectInput.tsx index 4e8f1203d..1c21e5e62 100644 --- a/src/lib/components/forms/SelectInput.tsx +++ b/src/lib/components/forms/SelectInput.tsx @@ -29,7 +29,7 @@ interface SelectInputProps { }[]; onChange: (newVal: T) => void; placeholder?: string; - initialSelected: string; + initialSelected?: string; hasDivider?: boolean; helperTextComponent?: ReactNode; labelBgColor?: string; @@ -81,11 +81,14 @@ export const SelectInput = ({ const selectedOption = options.find((item) => item.label === selected); useEffect(() => { + if (initialSelected) return; + setSelected( options.find((item) => !item.disabled && item.value === initialSelected) ?.label ?? "" ); - }, [initialSelected, options]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [initialSelected]); return ( ({ borderBottomColor: hasDivider && "gray.700", }, }} + overflow="scroll" > {options.map(({ label, value, disabled, icon, iconColor, image }) => (