diff --git a/src/pages/dashboard/components/RouteList.tsx b/src/pages/dashboard/components/RouteList.tsx index f6c086f1..5b8d1899 100644 --- a/src/pages/dashboard/components/RouteList.tsx +++ b/src/pages/dashboard/components/RouteList.tsx @@ -70,12 +70,8 @@ const RouteList: VoidComponent = (props) => { if (props.dongleId) { pages.length = 0 setSize(1) - refetch().catch((error: unknown) => { - if (error instanceof Error) { - console.error('Error refetching:', error.message); - } else { - console.error('Error refetching:', error); - } + refetch().catch((error: Error) => { + console.error('Error refetching:', error.message); }); } }) @@ -89,12 +85,8 @@ const RouteList: VoidComponent = (props) => { if (entries[0].isIntersecting) { batch(() => { setSize(size() + 1) - refetch().catch((error: unknown) => { - if (error instanceof Error) { - console.error('Error refetching:', error.message); - } else { - console.error('Error refetching:', error); - } + refetch().catch((error: Error) => { + console.error('Error refetching:', error.message); }); }) } @@ -159,23 +151,15 @@ const RouteList: VoidComponent = (props) => { // update sortedRoutes whenever allRoutes changes createEffect(() => { - try { - const newRoutesResult = allRoutes(); - if (newRoutesResult instanceof Error) { - throw newRoutesResult; - } - const newRoutes: Route[] = newRoutesResult; - setSortedRoutes((prevRoutes: Route[]) => { - const combinedRoutes: Route[] = [...prevRoutes, ...newRoutes]; - return sortRoutes(combinedRoutes); - }); - } catch (error: unknown) { - if (error instanceof Error) { - console.error('Error fetching all routes:', error.message); - } else { - console.error('Error fetching all routes:', error); - } + const newRoutesResult = allRoutes(); + if (newRoutesResult instanceof Error) { + throw newRoutesResult; } + const newRoutes: Route[] = newRoutesResult; + setSortedRoutes((prevRoutes: Route[]) => { + const combinedRoutes: Route[] = [...prevRoutes, ...newRoutes]; + return sortRoutes(combinedRoutes); + }); }); return ( @@ -219,4 +203,4 @@ const RouteList: VoidComponent = (props) => { ) } -export default RouteList \ No newline at end of file +export default RouteList