From 42be46de7c29afb23fd0bc2ad52b844e19c5d5ed Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 10 Jan 2024 08:54:08 +0530 Subject: [PATCH] add refresh logic to default options to refresh indexing status, every 2 seconds --- .../src/components/Search/SearchBar/searchInput/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx b/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx index 8e2b04a33..bbc25cc99 100644 --- a/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx +++ b/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx @@ -34,6 +34,7 @@ import { t } from 'i18next'; import memoize from 'memoize-one'; import { LocationTagData } from 'types/entity'; import { FILE_TYPE } from 'constants/file'; +import { addLogLine } from '@ente/shared/logging'; interface Iprops { isOpen: boolean; @@ -64,10 +65,15 @@ export default function SearchInput(props: Iprops) { useEffect(() => { refreshDefaultOptions(); + const t = setInterval(() => refreshDefaultOptions(), 2000); + return () => clearInterval(t); }, []); async function refreshDefaultOptions() { + const t = Date.now(); + addLogLine('refreshDefaultOptions called'); const defaultOptions = await getDefaultOptions(props.files); + addLogLine(`refreshDefaultOptions end time: ${Date.now() - t}ms`); setDefaultOptions(defaultOptions); }