Skip to content

refactor(web): extract useDragDropConfig (App.tsx decomposition, PR 6/7) - #185

Merged
falbany merged 22 commits into
mainfrom
refactor/148-pr6-drag-drop
Nov 17, 2026
Merged

falbany merged 22 commits into
mainfrom
refactor/148-pr6-drag-drop

Conversation

@falbany

@falbany falbany commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Part of #148 (PR 6/7 of the series in docs/superpowers/specs/2026-11-16-app-tsx-decomposition-design.md). Stacked on #178 → #179 → #182 → #184 — shows their commits until those PRs merge.

What

  • New hooks/useDragDropConfig.ts: the window-level config drag/drop slice moves out of App.tsx — overlay visibility state, the depth-counting drag tracker wiring, the four window listeners, handleDroppedConfig, and the Escape hard-reset seam (resetDrop(), consumed by useGlobalShortcuts's onEscape).
  • Behavior-preserving, quirks included: the []-dep listeners effect keeps its first-render showToast capture; the render-scope dropHandlerRef reassignment (latest-ref for the async config apply) is preserved verbatim; the swallowed catch with err.message || fallback stays; utils/configDrop.ts (pure tracker) untouched.
  • Additive applyConfigFile(file) seam serves DropConfigOverlay's click-to-pick path (plan gap found during execution: the overlay's onFileSelected prop routed through the same ref) — window-drop routing unchanged, App-side duplicate deleted.
  • loadConfigContent now imports wholly in the hook; App.tsx has zero drag vocabulary left (1257 lines, from 1317).

Safety net

  • 12-scenario hook suite: overlay depth wiring, both drop paths, non-config/no-file routing, both error toasts, latest-onConfigLoaded staleness pin (deps-bag replacement — verified to fail against a wrong mechanism), resetDrop depth-zeroing discriminator, applyConfigFile seam, unmount.

Test plan

  • cd src/profiles/web && npx vitest run green (366/366)
  • npm run build (tsc) clean
  • Manual: drag a .profiles over the window → overlay + session trial; drag a .txt → error toast; overlay click-to-pick → config applied; Escape mid-drag → overlay gone

@falbany
falbany merged commit 2ed457a into main Nov 17, 2026
3 checks passed
@falbany
falbany deleted the refactor/148-pr6-drag-drop branch November 17, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant