DUP-TS-2: useWorkingTreeDiff reimplements useDebouncedSessionResource #40
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
frontend/src/lib/useWorkingTreeDiff.ts(152 lines) manually re-implements the entire debounced-fetch machinery already present infrontend/src/lib/useDebouncedSessionResource.ts(160 lines).Duplicated code
DebouncedTriggerinitialisationabortRef+AbortControllerpatternfetchRefindirectionuseCallback-basedrefreshThe comment in
useWorkingTreeDiff.ts(lines 7–9) even says "Mirrors useSessionChanges".Divergence
useWorkingTreeDiffusesdiras the key (notsessionId) and has anotRepoflag for 404 errors.Fix
Extract a more general
useDebouncedResource(key, fetchFn, emptyValue, opts)hook that both consumers call.Effort
Medium — ~80% of code is shareable; the 404-specific
notRepoflag requires care.