File tree Expand file tree Collapse file tree
apps/code/src/renderer/features/command-center Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments