fix: fill location from autocomplete (#71) #72

Merged
Rustam merged 1 commits from feature/order-form-upgrade into main 2025-01-26 15:59:58 +03:00

View File

@ -42,6 +42,13 @@ export const LocationInput = memo(
const onInputChange: InputProps['onChange'] = async (e) => {
const newInputValue = e.target.value;
if (
isValidLocation(newInputValue) &&
(await isRealLocation(ymaps, newInputValue))
) {
onChange(newInputValue);
} else {
setInputValue(newInputValue);
if (newInputValue.trim().length > 3) {
@ -57,6 +64,7 @@ export const LocationInput = memo(
}
setIsSuggestionsPanelOpen(suggestions.length > 1);
}
};
const onFocus: InputProps['onFocus'] = () => {
@ -103,7 +111,7 @@ export const LocationInput = memo(
{...props}
ref={ref}
onBlur={onBlur}
value={inputValue}
value={inputValue ?? value}
onChange={onInputChange}
onFocus={onFocus}
placeholder={t('placeholder')}