digidem / digidem/comapeo-cloud-app

refactor(map): drop unused exports in saved-map-authoring, dedupe extractionContext rebuild

Open Beginner friendly
#360 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Unused exports in src/lib/map/saved-map-authoring.tsgetPackageRelevantMapConfig (line 47) and hasPackageRelevantMapConfigChanged (line 102) are exported 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 the export keyword is now dead surface area.

  2. Redundant extractionContext rebuild in src/screens/MapScreen/MapScreen.tsxextractionContext is built once via buildAuthoredLayerCommitContext (line 682) and consumed at lines 803/837, but validateAuthoredLayersForExtract (line 689) internally rebuilds an identical context object on every render. Cosmetic cost only.

Expected Behavior

  • The two helpers are module-private (export keyword 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: remove export from the two functions. That's it — no caller changes needed.
  • src/screens/MapScreen/MapScreen.tsx around lines 682–689: check validateAuthoredLayersForExtract's signature (exported from saved-map-authoring.ts) — either pass the existing extractionContext in, 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

  • getPackageRelevantMapConfig and hasPackageRelevantMapConfigChanged are no longer exported; grep -rn shows no external consumers
  • No redundant per-render context rebuild in MapScreen, or a comment documents why it stays
  • tsc --noEmit clean
  • 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.