Fix getDocument silently dropping a single string fields value - #2236
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesDocument fields query handling
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change preserves string and array field selections, with corresponding test coverage, and is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2236 +/- ##
=======================================
Coverage 98.15% 98.15%
=======================================
Files 14 14
Lines 706 706
Branches 107 106 -1
=======================================
Hits 693 693
Misses 12 12
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
DocumentQuery.fields accepts an array or a single field name, but getDocument only forwarded the array form. A string was replaced with undefined, so the fields query parameter never reached the server and the full document came back instead of the requested field.
db3f557 to
6b748a6
Compare
DocumentQuery.fields accepts an array of field names or a single field name, but getDocument only forwarded the array form. Passing a string (for example { fields: "title" }) replaced it with undefined, so the fields query parameter never reached the server and the full document came back instead of the selected field.
This change passes a string value through as-is and keeps joining arrays. Adds mocked-fetch tests covering the string form, the array form, and the omitted case.
Summary by CodeRabbit
Bug Fixes
Tests
titlefield returns the expected title value.