Skip to content

fix: follow-ups for #1886 and #1912 audit findings#2043

Merged
andrew-bierman merged 3 commits into
developmentfrom
fix/1886-1912-followups
Apr 11, 2026
Merged

fix: follow-ups for #1886 and #1912 audit findings#2043
andrew-bierman merged 3 commits into
developmentfrom
fix/1886-1912-followups

Conversation

@andrew-bierman
Copy link
Copy Markdown
Collaborator

Summary

Follow-up PR addressing the non-critical issues flagged in an audit of #1886 (Featured Packs) and #1912 (Trips feature flag) after they merged.

#1886 follow-ups

  • Removed 9 unused i18n keys under packTemplates that were added but never referenced (dayHike, overnight, weekendCamping, multiDay, winterHiking, winterCamping, tripDuration, environment, intendedUse).
  • Replaced the N+1 query pattern in FeaturedPackCard with a batched usePackTemplateSummaries selector. Previously each of 6 cards called usePackTemplateDetails, which materialised the full item list and recomputed weights for every card on every render. FeaturedPacksSection now computes item counts and base/total weight for all featured templates in a single pass and hands them to the cards as props.

#1912 follow-ups

  • Gated trip deep-link routes (/trip/[id], /trip/new, /upcoming-trips, /(tabs)/trips) behind featureFlags.enableTrips. Implement Trips feature (behind feature flag) #1912 hid the trips tab trigger and home tiles but left the underlying route files rendering, so packrat://trip/new still bypassed the kill switch. Each route now returns <Redirect href="/" /> when the flag is off. Trip feature components under features/trips/* are intentionally unchanged — the gating lives at the router entry points.

Test plan

  • bun run check-types clean
  • bun lint clean (exit 0 — only pre-existing warnings)
  • With enableTrips: false, tapping a trip deep link redirects home
  • Featured packs list renders without loading 100+ items per card

Removes nine keys added in #1886 under `packTemplates` that were never
referenced anywhere in the monorepo: dayHike, overnight, weekendCamping,
multiDay, winterHiking, winterCamping, tripDuration, environment,
intendedUse.
Previously each of the 6 featured pack cards called usePackTemplateDetails,
which materialised the full item list and recomputed base/total weight per
card. With a few hundred template items in the store that meant each
render iterated the items store 6 times for tiny "24 items" labels.

Introduces usePackTemplateSummaries, a batched selector that computes
itemCount / baseWeight / totalWeight for a set of template ids in a single
pass over packTemplateItemsStore. FeaturedPacksSection now computes
summaries once at the parent level and passes them as props, so cards no
longer subscribe to the full details hook.
#1912 added featureFlags.enableTrips and wired the tab trigger and home
tiles to hide when the flag is off, but the underlying route files still
rendered their screens. That meant deep links such as packrat://trip/new
or packrat://trip/:id rendered trip UI even with the kill switch off.

Adds a Redirect fallback to each app-router entry point:
- app/(app)/trip/[id]/index.tsx
- app/(app)/trip/new.tsx
- app/(app)/upcoming-trips.tsx
- app/(app)/(tabs)/trips/index.tsx

Feature components under features/trips/* are intentionally left alone —
the gating happens at the route level.
Copilot AI review requested due to automatic review settings April 11, 2026 05:10
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f5c09f5-777f-4869-86b4-417030a0a588

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1886-1912-followups

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Follow-up changes addressing audit findings from Featured Packs (#1886) and Trips feature-flag gating (#1912) in the Expo app.

Changes:

  • Removed unused packTemplates.* i18n keys from en.json.
  • Reduced Featured Packs render cost by batching pack-template item summary computations via a new usePackTemplateSummaries hook and passing summary props into cards.
  • Gated several trip route entry points behind featureFlags.enableTrips using <Redirect href="/" /> to prevent deep-link bypass.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/expo/lib/i18n/locales/en.json Removes unused Featured Packs-related translation keys.
apps/expo/features/pack-templates/hooks/usePackTemplateSummary.ts Adds per-template and batched summary hooks to avoid materializing full item lists for card stats.
apps/expo/features/pack-templates/hooks/index.ts Exports the new summary hook(s) from the hooks barrel.
apps/expo/features/pack-templates/components/FeaturedPacksSection.tsx Switches Featured Packs cards to use batched summaries and pass computed stats as props.
apps/expo/app/(app)/upcoming-trips.tsx Adds feature-flag redirect gate for the Upcoming Trips route.
apps/expo/app/(app)/trip/new.tsx Adds feature-flag redirect gate for the Trip Create route.
apps/expo/app/(app)/trip/[id]/index.tsx Adds feature-flag redirect gate for the Trip Detail route.
apps/expo/app/(app)/(tabs)/trips/index.tsx Adds feature-flag redirect gate for the Trips tab route.

Comment on lines 5 to 10
export default function TripDetailScreenRoute() {
// Gate deep links behind the trips feature flag so e.g. `packrat://trip/:id`
// cannot bypass the kill switch.
if (!featureFlags.enableTrips) return <Redirect href="/" />;
return <TripDetailScreen />;
}
@andrew-bierman andrew-bierman merged commit f2ee4df into development Apr 11, 2026
9 of 11 checks passed
@andrew-bierman andrew-bierman deleted the fix/1886-1912-followups branch April 11, 2026 05:39
andrew-bierman added a commit that referenced this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants