Skip to content

Commit

Permalink
lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
sarem-h committed Jun 13, 2024
1 parent 341c9b6 commit 691ee99
Showing 1 changed file with 13 additions and 29 deletions.
42 changes: 13 additions & 29 deletions src/pages/dashboard/components/RouteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@ const RouteList: VoidComponent<RouteListProps> = (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);
});
}
})
Expand All @@ -89,12 +85,8 @@ const RouteList: VoidComponent<RouteListProps> = (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);
});
})
}
Expand Down Expand Up @@ -159,23 +151,15 @@ const RouteList: VoidComponent<RouteListProps> = (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 (
Expand Down Expand Up @@ -219,4 +203,4 @@ const RouteList: VoidComponent<RouteListProps> = (props) => {
)
}

export default RouteList
export default RouteList

0 comments on commit 691ee99

Please sign in to comment.