You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1/arch] QueryFavorites.tsx 271 LOC with 8 useState hooks for transient UI state — should be a hook/store #340
QueryFavorites.tsx:19-31 has eight useState declarations, all of local UI state: editingId, editValue, editDescId, editDescValue, search, expanded, showNewCategory, newCategoryName.
Problem
The editingId/editValue pair is essentially the same modal state with two fields duplicated. The editDescId/editDescValue is the same again. This is the same pattern that admin.md flagged for AdminPanel.tsx (F4) and UserManagement.tsx (F4). The component is below the 271 LOC threshold but the state structure is the same smell.
Files
src/components/favorites/QueryFavorites.tsx:19-31
Expected
A focused presentational layer; transient state pulled into a custom hook or view store.
Proposed fix
Scope M — extract transient edit state into a single useEditingState hook returning { editingId, editValue, startEdit, confirm, cancel, editDescId, editDescValue, startEditDesc, confirmDesc, cancelDesc }. Move the local search/expanded/showNewCategory/newCategoryName into a useFavoritesViewState hook or a dedicated favoritesViewStore (Zustand per ARCHITECTURE §3.7).
Acceptance
QueryFavorites.tsx drops to ≤ 200 LOC and has ≤ 3 useState calls; the extracted hooks each have their own test file.
Activity
refactor(favorites): one inline editor, used twice (#617)