Skip to content

Commit d12104d

Browse files
committed
Redirect to new task when view state is corrupted
1 parent 4078b8d commit d12104d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/code/src/renderer/components/MainLayout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { useTaskDeepLink } from "../hooks/useTaskDeepLink";
2424
import { GlobalEventHandlers } from "./GlobalEventHandlers";
2525

2626
export function MainLayout() {
27-
const { view, hydrateTask } = useNavigationStore();
27+
const { view, hydrateTask, navigateToTaskInput } = useNavigationStore();
2828
const {
2929
isOpen: commandMenuOpen,
3030
setOpen: setCommandMenuOpen,
@@ -47,6 +47,12 @@ export function MainLayout() {
4747
}
4848
}, [tasks, hydrateTask]);
4949

50+
useEffect(() => {
51+
if (view.type === "task-detail" && !view.data && !view.taskId) {
52+
navigateToTaskInput();
53+
}
54+
}, [view, navigateToTaskInput]);
55+
5056
const handleToggleCommandMenu = useCallback(() => {
5157
toggleCommandMenu();
5258
}, [toggleCommandMenu]);

0 commit comments

Comments
 (0)