From b862313a99a06ccade09c555330e0301a0e6d566 Mon Sep 17 00:00:00 2001 From: stdavis Date: Mon, 18 Nov 2024 14:53:54 -0700 Subject: [PATCH] fix: clear input after selecting a result in stream/lake filter --- src/components/filters/Location.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/filters/Location.tsx b/src/components/filters/Location.tsx index 7e5b13a..d51ac9c 100644 --- a/src/components/filters/Location.tsx +++ b/src/components/filters/Location.tsx @@ -1,5 +1,6 @@ import Graphic from '@arcgis/core/Graphic'; import { + AsyncListItem, Button, featureServiceProvider, multiProvider, @@ -9,7 +10,7 @@ import { useFirebaseAuth, } from '@ugrc/utah-design-system'; import { useEffect } from 'react'; -import { useListData } from 'react-stately'; +import { AsyncListData, useListData } from 'react-stately'; import config from '../../config'; import { useFilter } from '../contexts/FilterProvider'; @@ -50,7 +51,10 @@ export default function Location(): JSX.Element { }); const { filterDispatch } = useFilter(); - const onSherlockMatch = (matches: Graphic[]) => { + const onSherlockMatch = (matches: Graphic[], context: { list: AsyncListData }) => { + // clear contents of input + context.list.setFilterText(''); + list.append(...matches); };