Skip to content

refactor(web): extract LanConfirmDialog + pathToFileUri (App.tsx decomposition, PR 7/7) - #186

Merged
falbany merged 27 commits into
mainfrom
refactor/148-pr7-lan-dialog
Nov 17, 2026
Merged

falbany merged 27 commits into
mainfrom
refactor/148-pr7-lan-dialog

Conversation

@falbany

@falbany falbany commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

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

What

  • New components/LanConfirmDialog.tsx: owns the LAN-toggle observe-and-verify flow (setLanEnabled → transitional toast → waitForLanState → outcome toasts, or failure → refetch), importing the api client directly (ConfigEditorModal precedent) and toasting its own outcomes with the current message texts verbatim (em-dash/ellipsis strings hexdump-verified). App keeps lanPending state and maps the observed SystemInfo back via onConfirmed(sys). The dialog-closes-first quirk is preserved (onCancel() at flow start — pinned via invocationCallOrder).
  • New utils/fileUri.ts:pathToFileUri replaces the new URL("file:///").href + backslash-replace construction, which was broken beyond UNC: POSIX paths got four leading slashes and # truncated the URI into a fragment. Now: UNC \\server\share\a.txt → file://server/share/a.txt, POSIX → file:///home/u/a.txt, spaces/non-ASCII percent-encoded, #/? escaped, literal % → %25 (anti-double-encoding). handleCopyUri becomes a thin caller.
  • Spec rule-⑥ erratum folded (docs-only): the PR 3 staleness mechanism text now describes the real subscription-time capture; verified against the actual useGlobalShortcuts code.

Safety net

  • 9-row pathToFileUri table (all four required mappings + encoding; adversarial-input sweep by the reviewer found nothing corrupting).
  • 7 LanConfirmDialog component tests incl. the discriminating dialog-closes-first pin (a mutation to the old flow shape fails it), observe-then-confirm, failure refetch, cancel.
  • Whole-branch review: READY TO MERGE; App.tsx 1925 → 1199 lines over the series.

Test plan

  • cd src/profiles/web && npx vitest run green (382/382)
  • npm run build (tsc) clean
  • Manual: StatusBar LAN toggle → dialog → enable/disable toasts; copy URI of a file on a Windows share

@falbany
falbany merged commit 48bc199 into main Nov 17, 2026
3 checks passed
@falbany
falbany deleted the refactor/148-pr7-lan-dialog 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.

Web UI: decompose App.tsx (1803 lines) into focused hooks + components

1 participant