From 4583b5f66ba670d6dffe76114c34a37cf1920e94 Mon Sep 17 00:00:00 2001 From: Dlurak <84224239+Dlurak@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:27:55 +0200 Subject: [PATCH] Fix broken flyto on mobile --- src/components/SearchBox/onHighlightFactory.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SearchBox/onHighlightFactory.ts b/src/components/SearchBox/onHighlightFactory.ts index be04d0666..0767b2398 100644 --- a/src/components/SearchBox/onHighlightFactory.ts +++ b/src/components/SearchBox/onHighlightFactory.ts @@ -1,3 +1,4 @@ +import { AutocompleteHighlightChangeReason } from '@mui/material'; import { Feature } from '../../services/types'; import { GeocoderOption, Option } from './types'; @@ -31,7 +32,9 @@ export const getSkeleton = ({ geocoder }: GeocoderOption): Feature => { }; export const onHighlightFactory = - (setPreview: (feature: unknown) => void) => (_: never, option: Option) => { + (setPreview: (feature: unknown) => void) => + (_: never, option: Option, reason: AutocompleteHighlightChangeReason) => { + if (reason === 'touch') return; if (!option) return; if (option.type === 'star' && option.star.center) { const { center } = option.star;