Skip to content

Commit e0546a1

Browse files
committed
move hook
1 parent ceacd24 commit e0546a1

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/renderer/features/tasks/components/TaskDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { RichTextEditor } from "@features/editor/components/RichTextEditor";
44
import { TaskActions } from "@features/tasks/components/TaskActions";
55
import { TaskHeader } from "@features/tasks/components/TaskHeader";
66
import { TaskMetadata } from "@features/tasks/components/TaskMetadata";
7-
import { useTaskPanelLayout } from "@features/tasks/components/useTaskPanelLayout";
87
import { useTasks, useUpdateTask } from "@features/tasks/hooks/useTasks";
98
import { useTaskExecutionStore } from "@features/tasks/stores/taskExecutionStore";
109
import { useBlurOnEscape } from "@hooks/useBlurOnEscape";
@@ -18,6 +17,7 @@ import { useTabStore } from "@stores/tabStore";
1817
import { expandTildePath } from "@utils/path";
1918
import { useEffect, useMemo } from "react";
2019
import { Controller, useForm } from "react-hook-form";
20+
import { useTaskPanelLayout } from "@/renderer/features/tasks/hooks/useTaskPanelLayout";
2121

2222
interface TaskDetailProps {
2323
task: Task;

src/renderer/features/tasks/components/useTaskPanelLayout.tsx renamed to src/renderer/features/tasks/hooks/useTaskPanelLayout.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ListIcon, NotePencilIcon, TerminalIcon } from "@phosphor-icons/react";
77
import { Box, Flex, Text } from "@radix-ui/themes";
88
import type { Task } from "@shared/types";
99
import type { PanelNode, Tab } from "@stores/panelStore";
10-
import { useEffect, useMemo, useRef } from "react";
10+
import { useLayoutEffect, useMemo, useRef } from "react";
1111

1212
interface UseTaskPanelLayoutParams {
1313
task: Task;
@@ -127,7 +127,7 @@ export const useTaskPanelLayout = ({
127127
[task.id, repoPath, activeArtifactId, onArtifactSelect],
128128
);
129129

130-
useEffect(() => {
130+
useLayoutEffect(() => {
131131
// Check if any meaningful values have changed
132132
const currentValues = {
133133
taskId: task.id,
@@ -280,18 +280,5 @@ export const useTaskPanelLayout = ({
280280
};
281281

282282
setRoot(panelStructure);
283-
}, [
284-
task.id,
285-
repoPath,
286-
openArtifacts,
287-
activeArtifactId,
288-
logsContent,
289-
shellContent,
290-
artifactsContent,
291-
taskDetailContent,
292-
onCloseArtifact,
293-
onSavePlan,
294-
panelId,
295-
setRoot,
296-
]);
283+
});
297284
};

0 commit comments

Comments
 (0)