Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/hook/useJobQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,8 @@ export const useEachTodosQuery = (todoGroupId: number) => {
return useQuery<EachTodos>({
queryKey: ['EachTodos', todoGroupId],
queryFn: () => EachTodos(todoGroupId),
retry: false, // 404 등 에러시 불필요한 재시도 방지 (체감 속도 향상)
refetchOnWindowFocus: false,
staleTime: 60 * 1000,
});
};
11 changes: 8 additions & 3 deletions src/pages/otherTodoList/OtherTodoListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ const OtherTodoListPage = () => {
isError,
} = useEachTodosQuery(Number(todoGroupId));

// 404 등 조회 에러 발생 시 내 할일로 리다이렉트
useEffect(() => {
if (isError) {
navigate('/mytodo/list', { replace: true });
}
}, [isError, navigate]);

if (isLoading) {
return (
<div className="flex h-full items-center justify-center">
Expand All @@ -36,9 +43,7 @@ const OtherTodoListPage = () => {
);
}

if (isError) {
return <div>에러가 발생했습니다.</div>;
}
// isError 시에는 상단 useEffect에서 리다이렉트 처리

if (!eachTodos)
return (
Expand Down