Skip to content

Commit 1a7416e

Browse files
authored
Trim verbose comments in command center autofill
Generated-By: PostHog Code Task-Id: 9b8fb3a5-83c9-4ca0-9a49-274c18e45792
1 parent 04a7be1 commit 1a7416e

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

apps/code/src/renderer/features/command-center/hooks/useAutofillCommandCenter.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ export function useAutofillCommandCenter(): void {
2828
const autofillCells = useCommandCenterStore((s) => s.autofillCells);
2929

3030
useEffect(() => {
31-
// Autofill is a one-time convenience to bootstrap an empty grid. Once it
32-
// has populated the grid (or the user has curated it), the persisted
33-
// `hasAutofilled` flag stops it from re-topping-up empty cells every time
34-
// the Command Center remounts — opening a task full-screen and coming back
35-
// no longer wipes out a deliberately trimmed layout.
31+
// One-time bootstrap: the persisted `hasAutofilled` flag stops empty cells
32+
// from being re-filled every time the Command Center remounts.
3633
if (hasAutofilled) return;
3734
if (!workspacesFetched || !workspaces) return;
3835
if (!tasksFetched) return;
@@ -52,10 +49,6 @@ export function useAutofillCommandCenter(): void {
5249
.slice(0, emptySlots)
5350
.map((task) => task.id);
5451

55-
// Hand the candidates to the store, which records the one-time bootstrap
56-
// — including when the grid is already full and there is nothing to place.
57-
// With no eligible tasks yet on a partial grid the flag stays unset, so
58-
// autofill can still bootstrap once recent tasks exist.
5952
autofillCells(candidates);
6053
}, [
6154
cells,

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ interface CommandCenterStoreState {
2626
activeCellIndex: number | null;
2727
zoom: number;
2828
creatingCells: number[];
29-
// True once autofill has bootstrapped the grid (or the user has curated it
30-
// by assigning a task). Persisted so autofill never repopulates cells the
31-
// user deliberately left empty when the Command Center remounts.
29+
// Persisted so autofill bootstraps the grid only once, not on every remount.
3230
hasAutofilled: boolean;
3331
}
3432

@@ -122,16 +120,14 @@ export const useCommandCenterStore = create<CommandCenterStore>()(
122120
cells,
123121
activeTaskId: taskId,
124122
creatingCells: state.creatingCells.filter((i) => i !== cellIndex),
125-
// Manually placing a task counts as curating the grid, so autofill
126-
// should never top up the remaining empty cells.
123+
// Manually placing a task counts as curating the grid.
127124
hasAutofilled: true,
128125
};
129126
}),
130127

131128
autofillCells: (taskIds) =>
132129
set((state) => {
133-
// Grid is already full — nothing to place, but the one-time
134-
// bootstrap is done, so record it and stop autofill from re-running.
130+
// Grid already full: nothing to place, but the bootstrap is done.
135131
if (state.cells.every((id) => id != null)) {
136132
return { hasAutofilled: true };
137133
}

0 commit comments

Comments
 (0)