fix: package activity linking fails with 'not same trip' error#45
fix: package activity linking fails with 'not same trip' error#45Systemsaholic merged 3 commits intomainfrom
Conversation
The linkChildrenToPackage validation compared activity.tripId directly, but regular activities have trip_id=null (only floating packages store it). Now resolves each child's trip through itinerary_day_id → itinerary_days → itineraries → trip_id, matching how trips are associated in the schema. fixes #43 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR fixes activity-to-package linking by introducing optimistic cache updates with error recovery on the frontend and enhancing backend trip ID resolution logic to infer missing trip identifiers from itinerary day references when direct trip IDs are unavailable. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Activities now disappear from the unlinked list immediately when added to a package, without waiting for a server refetch. On error, the cache is invalidated to restore correct state. fixes #43 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The package expanded row uses useBookingLinkedActivities which has its own query key. Must invalidate it alongside unlinked list removal so newly linked activities appear in the package immediately. fixes #43 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
linkChildrenToPackagecomparedactivity.tripIddirectly, but regular activities havetrip_id = nullin the DB — only floating packages store it. The migration backfilled existing data, so it worked initially but broke for any activity created after the migration.itinerary_day_id → itinerary_days → itineraries → trip_id) instead of using thetrip_idcolumn directly.Test plan
fixes #43
🤖 Generated with Claude Code
Summary by CodeRabbit