Commit c967c89
authored
refactor: decompose KanbanBoard God Component into focused hooks (#147)
* refactor: seal useRepositorySearch API — replace raw setters with semantic actions (#143)
- Replace setSearchQuery with updateSearch
- Replace setSelectedRepos([]) with clearSelection
- Replace setIsAdding(true/false) with startAdding/finishAdding
- Replace setAddError with setAddingError/clearError
- All actions wrapped in useCallback for referential stability
- startAdding() combines setIsAdding(true) + clearError() atomically
* refactor: extract useKanbanDnD hook from KanbanBoard (#141, #145)
- Extract ~195 lines of DnD logic into src/hooks/board/useKanbanDnD.ts
- Move forgivingCollisionDetection, sensors, drag handlers, grid calculations
- Column sub-handlers (handleNewRowDrop, handleColumnInsertDrop, handleColumnSwap) included
- handleDragEnd split into column/card branches per #145
- History state stays in KanbanBoard via pushCardHistory/pushColumnHistory callbacks
- All handlers wrapped in useCallback with correct dependency arrays
* refactor: extract useKanbanUndo hook from KanbanBoard (#142)
- Extract history/columnHistory state, handleUndo, Z-key useEffect
- Hook is self-contained: keyboard shortcut registered internally
- Returns pushCardHistory/pushColumnHistory for useKanbanDnD consumption
- KanbanBoard no longer imports setStatusLists/setRepoCards directly
- Removes ~73 lines from KanbanBoard
* refactor: extract useCommentState hook from KanbanBoard (#144)
- Extract comments state + 3 CRUD handlers into useCommentState hook
- Preserve optimistic updates, Sentry error tracking, and toast feedback
- KanbanBoard now imports zero direct server actions
- Removed unused imports: useState, useCallback, Sentry, toast, CommentColor
- KanbanBoard reduced from 825 → 295 lines (completes decomposition)
* fix: address CodeRabbit review — error handling + Z-key modifier guard
- useCommentState: convert unreachable try/catch to result.success pattern
(server actions return ActionResult, never throw)
- useCommentState: add rollback + toast on all 3 handlers failure path
- useCommentState: remove duplicate Sentry reporting (server already reports)
- useKanbanUndo: guard Z-key handler with !ctrlKey && !metaKey && !altKey
to avoid conflict with browser Ctrl+Z undo
* refactor: replace dynamic import with static for updateStatusListPosition
Address CodeRabbit nitpick: align updateStatusListPosition import
with other board actions that are already statically imported.1 parent 4e3451a commit c967c89
File tree
7 files changed
+932
-620
lines changed- src
- components/Board
- hooks/board
7 files changed
+932
-620
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | 112 | | |
114 | | - | |
| 113 | + | |
| 114 | + | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
256 | | - | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
| |||
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
290 | | - | |
291 | | - | |
| 292 | + | |
| 293 | + | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
307 | | - | |
| 309 | + | |
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
311 | | - | |
| 313 | + | |
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
| |||
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
370 | | - | |
| 372 | + | |
371 | 373 | | |
372 | 374 | | |
373 | 375 | | |
| |||
0 commit comments