fix(router-core): handle constructor search fields without throwing - #8350
fix(router-core): handle constructor search fields without throwing#8350Tnalxmsk wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe router now safely processes search parameters with a ChangesConstructor search parameter handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Constructor-valued search parameters are handled safely during router initialization and client navigation, with the reported crash paths covered by tests. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
🎯 Changes
Visiting
/?constructor=nullwith the default search parser throws during client router initialization, beforevalidateSearchcan run, even withsearch.strict: true. Client navigation with the same search value also throws. A JSONconstructorobject whoseprototype.hasOwnPropertyis not callable triggers a similar failure.isPlainObjectreads the input'sconstructorfield as constructor metadata. Guard the nullable prototype access and use the existinghasOwnhelper instead of calling a method on that metadata.Add regression coverage for initial loading with strict search validation and for preserving
constructorsearch values during client navigation. The failing inputs were reproduced with@tanstack/react-router@1.170.35in a production browser bundle; with the fix, the route renders and subsequent navigation works.Validation
✅ Checklist
🚀 Release Impact
Summary by CodeRabbit
constructorfield.null, numeric, text, or object values are now safely encoded, parsed, and preserved in the URL and router state.hasOwnPropertyvalues.