Fix: Android error page on second trip edit attempt#1893
Fix: Android error page on second trip edit attempt#1893
Conversation
- EditTripScreen: replace assertDefined(trip) with graceful loading state so a transient undefined from the Legend-State sync doesn't cause an unhandled exception and the Expo Router error page - TripForm: clear tripLocationStore on mount and unmount to stop stale locations from a previous session bleeding into the next edit - TripForm: use trip?.location as the form default instead of the potentially-stale global tripLocationStore value Co-authored-by: andrew-bierman <94939237+andrew-bierman@users.noreply.github.com>
|
@coderabbitai Please review this PR for code quality, best practices, and potential issues. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 100 🏁 Script executed: Length of output: 3399 🏁 Script executed: Length of output: 18404
Overall AssessmentThe core fix is well-reasoned — replacing the throwing 🔴 High — Infinite Loading Spinner (
|
| Severity | File | Issue |
|---|---|---|
| 🔴 High | EditTripScreen.tsx |
Infinite spinner with no error/timeout recovery |
| 🟡 Medium | TripForm.tsx |
Cannot clear pre-existing trip location |
| 🟡 Medium | TripForm.tsx |
Dead assertDefined(dateStr) assertion |
| 🟡 Medium | TripForm.tsx |
No start/end date cross-validation |
| 🟢 Low | location-search.tsx |
API key re-derived on every render |
| 🟢 Low | location-search.tsx |
console.warn/console.error in production |
🧠 Learnings used
Learnt from: CR
Repo: PackRat-AI/PackRat PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-03-01T10:08:42.658Z
Learning: Applies to apps/expo/app/**/*.{ts,tsx} : When modifying the mobile app, update apps/expo/app/ for screen changes using Expo Router
|
@copilot CodeRabbit has provided review feedback on this PR. Please review and address the comments. |
- EditTripScreen: add 10s timeout with error state + back button so the activity indicator never spins forever if the trip is missing - TripForm: show Clear location button for existing trip location too; form.setFieldValue clears the form field alongside the store - TripForm: remove dead assertDefined(dateStr) calls (split()[0] is always a string) - TripForm: add end>=start date cross-validation via Zod refine using Date object comparison - location-search: move GOOGLE_MAPS_API_KEY to module scope - location-search: remove console.warn/console.error in production Co-authored-by: andrew-bierman <94939237+andrew-bierman@users.noreply.github.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
After a successful trip edit, navigating back to edit the same trip again consistently showed Expo Router's error page. The issue was a throwing
assertDefinedguard inEditTripScreencombined with a stale global location store leaking between sessions.Changes
EditTripScreen— replacedassertDefined(trip)(which throws) with a graceful loading state. A 10-second timeout is added: if the store does not resolve (e.g. stale/deleted trip ID), the spinner is replaced with an error message and a "Go back" button so the user is never stuck indefinitely.TripForm— several improvements:useEffectresetstripLocationStoretonullon both mount (clearing stale state from a previous session) and unmount (cleaning up for the next form), preventing location data from one edit leaking into the next.defaultValues.locationnow usestrip?.locationinstead of the potentially-stale global store value.assertDefined(dateStr)calls on the result ofsplit()[0], which can never beundefined..refine()that ensures end date is not before start date, usingDateobject comparison.location-search.tsx— two improvements:GOOGLE_MAPS_API_KEYderivation to module scope (was re-evaluated on every render).console.warn/console.errorstatements that leaked internal data in production builds (user feedback is already handled byAlert).Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.