From 92849cf7a3075d7b3f7fe80907616938dd8af839 Mon Sep 17 00:00:00 2001 From: Law Wai Chun Date: Sun, 12 May 2024 08:22:58 +0800 Subject: [PATCH] Set refresh to nearby page --- src/components/home/lists/NearbyRouteList.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/home/lists/NearbyRouteList.tsx b/src/components/home/lists/NearbyRouteList.tsx index d32a398a6f93..f78440e08021 100644 --- a/src/components/home/lists/NearbyRouteList.tsx +++ b/src/components/home/lists/NearbyRouteList.tsx @@ -37,12 +37,18 @@ const NearbyRouteList = ({ isFocus }: NearbyRouteListProps) => { () => throttle((geolocation: Location) => { setState(geolocation); - }, 1000), + }, 500), [] ); useEffect(() => { + const interval = setInterval(() => { + throttleUpdateGeolocation(manualGeolocation ?? geolocation.current); + }, 1000); throttleUpdateGeolocation(manualGeolocation ?? geolocation.current); + return () => { + clearInterval(interval); + }; }, [manualGeolocation, geolocation, throttleUpdateGeolocation]); const routes = useMemo(