chore(web): simplification sweep — dead exports, shared media-query hook - #988
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #988 +/- ##
==========================================
- Coverage 71.62% 71.62% -0.01%
==========================================
Files 310 311 +1
Lines 15833 15807 -26
Branches 3216 3383 +167
==========================================
- Hits 11341 11322 -19
+ Misses 4298 4291 -7
Partials 194 194
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Behaviour-preserving cleanup of 7 findings from the 2026-08-12 and 2026-08-17 simplify-web audits. No production behaviour changes. Deletions (each verified to have zero references first): - `AvailableYear` type export (constants/sidebar.ts) - `MultiDailySportData`, `FirebaseConfig`, `EmulatorConfig` types - the speculative `_userPrefs` parameter on `getPrimaryMetric`, its @PARAM doc and its commented-out implementation `AppConfig` sat inside the same finding's line range but has three live uses, so it was left alone. The `_userPrefs` test went with the parameter: it only asserted the argument was ignored, and no production caller ever passed one. Extractions: - `useMediaQuery` — `useIsMobile` and `useReducedMotion` were byte-identical apart from the query string and state name; both are now thin wrappers - `goalToDisplayValue` in dashboardUtils — the target and impact goals each ran their own copy of the isDistance/isTime/else chain Idiom: - `filterActualActivityData` uses `.filter()` instead of an index loop - `Object.fromEntries` for the demo-goals map; redundant `.toString()` dropped inside a template literal `useMediaQuery` is deliberately a byte-for-byte port, including the gap where a change between the `useState` initializer and the effect subscribing is missed. Closing that is a behaviour change and belongs in its own commit; the reasoning is recorded in the new file. Two findings from these audits are intentionally not included: - collapsing `useSportConfig` / `usePublicSportConfig`: the two hooks differ in auth posture (one attaches a Firebase ID token, one must never), so merging them risks attaching a token to a non-internal request. Needs a deliberate decision, not a sweep. - consolidating the chart-tooltip surface style: gated on the tooltip-converge work, which will delete one of the duplicate copies outright. web-test 1650 passed, web-lint and web-typecheck clean.
andy-esch
force-pushed
the
chore/simplify-sweep-web
branch
from
September 1, 2026 10:49
29c7cfe to
beccbd8
Compare
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.
Behaviour-preserving cleanup of 7 findings from the 2026-08-12 and 2026-08-17 simplify-web audits. No production behaviour changes.
Deletions (each verified to have zero references first):
AvailableYeartype export (constants/sidebar.ts)MultiDailySportData,FirebaseConfig,EmulatorConfigtypes_userPrefsparameter ongetPrimaryMetric, its @PARAM doc and its commented-out implementationAppConfigsat inside the same finding's line range but has three live uses, so it was left alone. The_userPrefstest went with the parameter: it only asserted the argument was ignored, and no production caller ever passed one.Extractions:
useMediaQuery—useIsMobileanduseReducedMotionwere byte-identical apart from the query string and state name; both are now thin wrappersgoalToDisplayValuein dashboardUtils — the target and impact goals each ran their own copy of the isDistance/isTime/else chainIdiom:
filterActualActivityDatauses.filter()instead of an index loopObject.fromEntriesfor the demo-goals map; redundant.toString()dropped inside a template literaluseMediaQueryis deliberately a byte-for-byte port, including the gap where a change between theuseStateinitializer and the effect subscribing is missed. Closing that is a behaviour change and belongs in its own commit; the reasoning is recorded in the new file.Two findings from these audits are intentionally not included:
useSportConfig/usePublicSportConfig: the two hooks differ in auth posture (one attaches a Firebase ID token, one must never), so merging them risks attaching a token to a non-internal request. Needs a deliberate decision, not a sweep.web-test 1650 passed, web-lint and web-typecheck clean.