Simplify: apply a batch of safe, behavior-preserving code cleanups - #27
Merged
Merged
Conversation
A curated set from an app-wide analysis — each verified behavior-preserving and guarded by the type-checker + tests: - Shared helpers replace copies: `stampNow` (schema/helpers, was duplicated in all three stores), `formatPercentFloor` (lib/format, was inlined 4× across the stats screens), `isOffline` (GuideButton, was repeated 3×). - Reuse existing constants/values: MapScreen imports `IN_VIEW_CAP` from viewport (was a second copy); MapView's trip-arcs reset reuses `EMPTY_FC`; TripComposer maps over the shared `MODE_ORDER` instead of its own mode list. - Smaller reads: Backup reuses its `hasData` flag; SyncSection drops a needless `Promise.all([import])` wrapper. - Tighter surface: drop `export` from types only used in their own module (PosterStats, PhotoRef, MapMode, CityStatus). No behavior change. Gate: tsc clean, 459 unit tests, e2e green (smoke, a11y, trip-reconstruction, filter-panel, offline).
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A curated set from an app-wide simplification analysis. Each cleanup was verified behavior-preserving and is guarded by the type-checker + tests — no behavior change.
stampNow(→schema/helpers, was duplicated in all three Zustand stores),formatPercentFloor(→lib/format, was inlined 4× across the stats screens),isOffline(inGuideButton, was repeated 3×).MapScreenimportsIN_VIEW_CAPfromviewport(was a second copy);MapView's trip-arcs reset reusesEMPTY_FC;TripComposermaps over the sharedMODE_ORDERinstead of its own list.Backupreuses itshasDataflag;SyncSectiondrops a needlessPromise.all([import])wrapper.exportfrom types used only in their own module (PosterStats,PhotoRef,MapMode,CityStatus).The analysis surfaced ~45 candidates; this PR takes the unambiguous, low-risk subset. The rest (larger refactors like a shared
NearbyListcomponent or a prefetch-pool helper, and a couple of schema-transform dedups) are left for a focused follow-up.Gate:
tscclean · 459 unit tests · e2e green (smoke, a11y, trip-reconstruction, filter-panel, offline).🤖 Generated with Claude Code
https://claude.ai/code/session_014W6tgHRgLEugCsbKC9ccST
Generated by Claude Code