Skip to content

[Fix] PWA polish: remove type lies, dead config, and edge-swipe dead zone#187

Merged
samzong merged 1 commit intomainfrom
fix/pwa-polish
Mar 27, 2026
Merged

[Fix] PWA polish: remove type lies, dead config, and edge-swipe dead zone#187
samzong merged 1 commit intomainfrom
fix/pwa-polish

Conversation

@samzong
Copy link
Copy Markdown
Collaborator

@samzong samzong commented Mar 27, 2026

Summary

Bundle six independent P3 polish items for the PWA package: eliminate non-null assertion type lies, remove dead tsconfig configuration, add missing service worker cache header, establish IndexedDB migration path, and reduce edge-swipe dead zone width.

Type of change

  • [Fix] bug fix

Why is this needed?

Each item individually is small but collectively they address: (1) two ! non-null assertions that lie to the type checker and mask potential runtime errors, (2) a dead @/* path alias that misleads contributors, (3) a missing sw.js cache header that relies on implicit browser behavior instead of explicit spec-compliant policy, (4) an IndexedDB upgrade callback with no version guard that will break on the first schema change, and (5) a 20px edge-swipe detector that creates an unnecessarily large tap dead zone.

What changed?

  • stores/hooks.ts: Replace selector! with conditional overload dispatch (selector ? useStore(api, selector) : useStore(api)) in all three store hooks
  • tsconfig.json: Remove unused baseUrl and paths entries
  • public/_headers: Add /sw.js with Cache-Control: public, max-age=0, must-revalidate
  • persistence/db.ts: Add oldVersion parameter to upgrade callback and wrap store creation in if (oldVersion < 1)
  • platform/index.ts: Replace _gwResult! with local variable extraction and runtime invariant check
  • views/DrawerLayout.tsx: Reduce edge-swipe detector width from 20px to 12px

Architecture impact

  • Owning layer: renderer (PWA package)
  • Cross-layer impact: none
  • Invariants touched from docs/architecture-invariants.md: none
  • Why those invariants remain protected: all changes are internal to the PWA package with no cross-layer or cross-package effects

Linked issues

N/A

Validation

  • pnpm lint
  • pnpm test
  • pnpm build
  • pnpm check:ui-contract
  • Manual smoke test
  • Not run

Commands, screenshots, or notes:

pnpm typecheck — passed
pnpm test — 157 tests passed (shared 6, pwa 59, desktop 92)
pnpm lint — passed
pnpm check:architecture — passed
pnpm check:ui-contract — passed

Screenshots or recordings

No UI changes beyond the edge-swipe detector width reduction (20px → 12px), which is invisible — it only affects the touch target area.

Release note

  • No user-facing change. Release note is NONE.
  • User-facing change. Release note is included below.
NONE

Checklist

  • The PR title uses at least one approved prefix: [Feat], [Fix], [UI], [Docs], [Refactor], [Build], or [Chore]
  • The summary explains both what changed and why
  • Validation reflects the commands actually run for this PR
  • Architecture impact is described and references any touched invariants
  • Cross-layer changes are explicitly justified
  • The release note block is accurate

- Replace selector! non-null assertions with conditional overload dispatch
- Remove unused @/* path alias from tsconfig
- Add sw.js no-cache header for spec-compliant SW update
- Wrap IndexedDB upgrade in oldVersion guard for migration path
- Replace _gwResult! with runtime invariant check
- Reduce edge-swipe detector width from 20px to 12px
@github-actions
Copy link
Copy Markdown
Contributor

Hi @samzong,
Thanks for your pull request!
If the PR is ready, use the /auto-cc command to assign Reviewer to Review.
We will review it shortly.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@samzong samzong merged commit d5835c1 into main Mar 27, 2026
7 checks passed
@samzong samzong deleted the fix/pwa-polish branch March 29, 2026 14:10
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