digidem / digidem/comapeo-cloud-app
refactor(map): drop unused exports in saved-map-authoring, dedupe extractionContext rebuild
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 29
Description
Problem
Two cosmetic (non-blocking) findings from the Opus 5 confirming review of PR #350, deferred at merge time because neither affects behavior:
-
Unused exports in
src/lib/map/saved-map-authoring.ts—getPackageRelevantMapConfig(line 47) andhasPackageRelevantMapConfigChanged(line 102) areexported but have zero consumers outside the module (verified: the only callers are internal, at lines 106 and 444). During the PR #350 nit round they gained an internal-only call site, so theexportkeyword is now dead surface area. -
Redundant
extractionContextrebuild insrc/screens/MapScreen/MapScreen.tsx—extractionContextis built once viabuildAuthoredLayerCommitContext(line 682) and consumed at lines 803/837, butvalidateAuthoredLayersForExtract(line 689) internally rebuilds an identical context object on every render. Cosmetic cost only.
Expected Behavior
- The two helpers are module-private (
exportkeyword dropped) so the module's public API reflects real consumers. - The duplicate context construction is either eliminated (share the built context) or documented as intentional.
Implementation Notes
src/lib/map/saved-map-authoring.ts: removeexportfrom the two functions. That's it — no caller changes needed.src/screens/MapScreen/MapScreen.tsxaround lines 682–689: checkvalidateAuthoredLayersForExtract's signature (exported fromsaved-map-authoring.ts) — either pass the existingextractionContextin, or have the validator accept the prebuilt context. If the validator's internal rebuild is deliberate (e.g. defensive copy), add a one-line comment instead.- Pure refactor: no behavior change expected;
tsc --noEmit+ existing unit tests (tests/unit/lib/map/saved-map-authoring.test.ts, MapScreen suite) should pass untouched. - Trivial diff,
difficulty:small.
Acceptance Criteria
-
getPackageRelevantMapConfigandhasPackageRelevantMapConfigChangedare no longer exported;grep -rnshows no external consumers - No redundant per-render context rebuild in MapScreen, or a comment documents why it stays
-
tsc --noEmitclean - Focused unit tests pass (saved-map-authoring, MapScreen)
Filed from the Opus 5 confirming review of PR #350 (merge commit 20ea92d).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/lib/map/saved-map-authoring.ts and remove the exports from the two named helpers, then inspect src/screens/MapScreen/MapScreen.tsx around lines 682–689 for the duplicate context rebuild. Run tsc --noEmit and the saved-map-authoring and MapScreen tests; done means no external consumers remain and the rebuild is removed or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- mobile-dev
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100