Skip to content

Commit 96fb3e2

Browse files
committed
fix(code): remove archived tasks from command center
1 parent 4b71aa2 commit 96fb3e2

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

apps/code/src/renderer/features/command-center/stores/commandCenterStore.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface CommandCenterStoreActions {
2929
setLayout: (preset: LayoutPreset) => void;
3030
assignTask: (cellIndex: number, taskId: string) => void;
3131
removeTask: (cellIndex: number) => void;
32+
removeTaskById: (taskId: string) => void;
3233
clearAll: () => void;
3334
setZoom: (zoom: number) => void;
3435
zoomIn: () => void;
@@ -86,6 +87,15 @@ export const useCommandCenterStore = create<CommandCenterStore>()(
8687
return { cells };
8788
}),
8889

90+
removeTaskById: (taskId) =>
91+
set((state) => {
92+
const index = state.cells.indexOf(taskId);
93+
if (index === -1) return state;
94+
const cells = [...state.cells];
95+
cells[index] = null;
96+
return { cells };
97+
}),
98+
8999
clearAll: () =>
90100
set((state) => ({
91101
cells: state.cells.map(() => null),

apps/code/src/renderer/features/tasks/hooks/useArchiveTask.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useCommandCenterStore } from "@features/command-center/stores/commandCenterStore";
12
import { getSessionService } from "@features/sessions/service/service";
23
import { pinnedTasksApi } from "@features/sidebar/hooks/usePinnedTasks";
34
import { useTerminalStore } from "@features/terminal/stores/terminalStore";
@@ -33,6 +34,7 @@ export function useArchiveTask() {
3334

3435
pinnedTasksApi.unpin(taskId);
3536
useTerminalStore.getState().clearTerminalStatesForTask(taskId);
37+
useCommandCenterStore.getState().removeTaskById(taskId);
3638

3739
queryClient.setQueryData<string[]>(
3840
trpc.archive.archivedTaskIds.queryKey(),

0 commit comments

Comments
 (0)