Web UI: decompose App.tsx (1803 lines) into focused hooks + components
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- developer-experience, frontend
Research direction
Start with App.tsx and the presentation-layer rules in AGENTS.md; the issue gives line ranges for each proposed hook, component, and helper. Follow the suggested sequence, beginning with useScanController and the five duplicated scan flows. Finish when the listed responsibilities are extracted into focused, independently testable pieces and the test suite remains green.
Written by the indexing model from the issue text.
Description
Problem
App.tsx is a 1803-line monolith mixing scan orchestration, theme, barcode mode, drag-drop, global shortcuts, LAN toggle, telemetry and more. AGENTS.md's presentation-layer rules (delegate business logic to core, UI only) are hard to enforce at this size, and several bugs found in this audit trace directly to the tangle (stale closures in the scan flow, shortcut-guard gaps, duplicated scan-merge logic).
Concrete decomposition plan (each hook independently testable)
useScanController—files/totalCount/hasScanned/scanning/loadingMore, generation + abort refs (App.tsx:85-89, 175-196),loadScanResults,runScan,handleLoadMore, and a singlescanWith(params)replacing the five duplicatedtry { await runScan(...) } catch { showToast } finally { finishScan }blocks (App.tsx:666-681, 723-739, 742-758, 832-843, 845-856).useToast— lines 98, 147-168.useExternalEvents— the notification poll +externalConfigApplyRef(lines 445-476).useBarcodeMode— state, buffer ref, capture-phase keydown effect,applyBarcodeValues(lines 132-133, 1085-1191).useAutoRescanTimer—autoRescanInterval+ interval effect (lines 144-145, 1196-1217).useGlobalShortcuts(anyModalOpen, …)— the 200-line keydown effect (lines 1223-1444).useTheme— theme state + persistence effect (fixes #129 at the same time).useDragDropConfig— drag tracker refs + window listeners +handleDroppedConfig(lines 418-511).
Components: extract LanConfirmDialog (lines 1722-1785 — the waitForLanState observe-and-verify flow is ~60 lines of inline JSX + logic).
Business logic that should leave the UI per AGENTS.md:
handleCopyUri's path→URI construction (line 895) → purepathToFileUri()inutils/(currently also wrong for UNC paths).- The barcode
shouldScandecision (lines 1111-1117) →utils/barcodeScanner.ts. - The three duplicated "merge extension/filter from directoryConfig" blocks (lines 531-536, 644-649, 387-394) → one pure helper.
handleCameraDetected's inline duplicate ofrunScan(lines 1043-1082 vs 274-285) → reuse the scan controller.
Suggested sequencing
Do it in slices that keep the suite green (config-editor tests already cover the editor slice): scan controller first (kills the five duplicated blocks), then shortcuts/theme/barcode, then the component extractions.
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 4h 46m
- Merged PRs (30d)
- 55
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from falbany/ProFiles
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
falbany/ProFiles#187 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
All issues in falbany/ProFiles
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ip-tools/patzilla#219 · 2 comments ·
Maintainers usually reply within 1 day
-
EPSSClient commits to its SQLite cache once per score: a 100-CVE bulk fetch makes 101 disk flushesOpenpriority:p3 technical-debt
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jimmy058910/jmo-security-repo#1673 ·
Maintainers usually reply within 1 day
-
enhancement ready
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
integration: frontier_silicon
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
home-assistant/core#193176 · 2 comments ·
Maintainers usually reply within 1 day
-
task create and task update take --body-file and --stdinPossibly taken @JuanBarriosS claimed this today. Opencli enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
pyrite-wiki/pyrite#1687 · 1 comment ·
Maintainers usually reply within 1 day