Skip to content

Commit a6e2adc

Browse files
committed
fix: layout persisting while moving aorund between tasks
1 parent 0855cc4 commit a6e2adc

File tree

12 files changed

+330
-319
lines changed

12 files changed

+330
-319
lines changed

pnpm-lock.yaml

Lines changed: 5 additions & 146 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ packages:
33

44
onlyBuiltDependencies:
55
- electron
6-
- esbuild
6+
- esbuild
7+
8+
overrides:
9+
'@posthog/agent': link:../agent

src/renderer/components/MainLayout.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ import { TaskDetail } from "@features/task-detail/components/TaskDetail";
88
import { TaskList } from "@features/task-list/components/TaskList";
99
import { useIntegrations } from "@hooks/useIntegrations";
1010
import { Box, Flex } from "@radix-ui/themes";
11-
import { track } from "@renderer/lib/analytics";
1211
import type { Task } from "@shared/types";
1312
import { useLayoutStore } from "@stores/layoutStore";
1413
import { useNavigationStore } from "@stores/navigationStore";
1514
import { useCallback, useEffect, useState } from "react";
1615
import { useHotkeys } from "react-hotkeys-hook";
1716
import { Toaster } from "sonner";
18-
import { ANALYTICS_EVENTS } from "@/types/analytics";
1917

2018
export function MainLayout() {
2119
const { setCliMode } = useLayoutStore();
@@ -59,12 +57,6 @@ export function MainLayout() {
5957

6058
const handleSelectTask = (task: Task) => {
6159
navigateToTask(task);
62-
63-
// Track task view
64-
track(ANALYTICS_EVENTS.TASK_VIEWED, {
65-
task_id: task.id,
66-
has_repository: !!task.repository_config,
67-
});
6860
};
6961

7062
return (

src/renderer/features/editor/components/PlanEditor.tsx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { RichTextEditor } from "@features/editor/components/RichTextEditor";
22
import { Box, Button, Flex, TextArea } from "@radix-ui/themes";
33
import { useQuery, useQueryClient } from "@tanstack/react-query";
4-
import { useCallback, useEffect, useRef, useState } from "react";
4+
import { useCallback, useEffect, useState } from "react";
55

66
interface PlanEditorProps {
77
taskId: string;
@@ -21,7 +21,6 @@ export function PlanEditor({
2121
const [content, setContent] = useState(initialContent || "");
2222
const [isSaving, setIsSaving] = useState(false);
2323
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
24-
const saveTimeoutRef = useRef<number | null>(null);
2524

2625
const isMarkdownFile = fileName.endsWith(".md");
2726

@@ -46,7 +45,6 @@ export function PlanEditor({
4645
},
4746
});
4847

49-
// Seed editor once with fetched content if no initial content was provided
5048
useEffect(() => {
5149
if (!initialContent && fetchedContent && content === "") {
5250
setContent(fetchedContent);
@@ -65,10 +63,6 @@ export function PlanEditor({
6563
taskId,
6664
contentToSave,
6765
);
68-
} else {
69-
console.warn(
70-
`Saving ${fileName} - generic artifact writing not yet implemented`,
71-
);
7266
}
7367
onSave?.(contentToSave);
7468
queryClient.setQueryData(
@@ -98,25 +92,6 @@ export function PlanEditor({
9892
}
9993
}, [content, fetchedContent]);
10094

101-
// Auto-save with debounce
102-
useEffect(() => {
103-
if (saveTimeoutRef.current) {
104-
clearTimeout(saveTimeoutRef.current);
105-
}
106-
107-
saveTimeoutRef.current = setTimeout(() => {
108-
if (content !== fetchedContent) {
109-
handleSave(content);
110-
}
111-
}, 500);
112-
113-
return () => {
114-
if (saveTimeoutRef.current) {
115-
clearTimeout(saveTimeoutRef.current);
116-
}
117-
};
118-
}, [content, fetchedContent, handleSave]);
119-
12095
return (
12196
<Flex
12297
direction="column"

0 commit comments

Comments
 (0)