fix(query): don't corrupt query keys that collide with Object.prototype - #2797
fix(query): don't corrupt query keys that collide with Object.prototype#2797contactjawad wants to merge 1 commit into
Conversation
✅ Deploy Preview for vue-router canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesQuery parsing
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This change prevents query keys matching inherited object properties from being corrupted while preserving repeated-key handling. It is localized and merge-ready after normal checks, with no actionable merge-blocking risk remaining. 🚥 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 |
|
Thanks but see #2658 |
A query key that happens to be an
Object.prototypemember gets mangled:parseQueryaccumulates into a plain{}and checks for repeated keys withkey in query. Sinceinwalks the prototype chain,toString(andvalueOf,hasOwnProperty, …) look like they already exist on the first occurrence, so the value gets wrapped in an array with the inherited function.I switched the accumulator to
Object.create(null)— which is what the TODO in the file and the experimental implementation already point at. Added a test.Summary by CodeRabbit
toString,valueOf, andhasOwnProperty.