Conversation
📝 WalkthroughWalkthroughThis PR adds a changelog entry and optimizes the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
View your CI Pipeline Execution ↗ for commit 5100e29
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 12 bumped as dependents. 🟩 Patch bumps
|
|
relates to #1545 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2119 +/- ##
==========================================
- Coverage 90.35% 90.20% -0.16%
==========================================
Files 38 49 +11
Lines 1752 2031 +279
Branches 444 531 +87
==========================================
+ Hits 1583 1832 +249
- Misses 149 179 +30
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/form-core/src/utils.ts`:
- Around line 156-165: The path parser currently leaves a leading empty segment
for paths like ".child" (produced by concatenatePaths) because it doesn't strip
leading dots; update the replace chain that processes the path (the
.replace(/(^\[)|]/g, '')... sequence) to remove any leading dots before
splitting (e.g. add .replace(/^\.+/, '') or equivalent) so that ".child" becomes
"child" and downstream helpers (getBy, setBy, deleteBy) no longer treat an
empty-string key as the first segment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5c261b4a-32bc-4d4f-b0ec-4cc0e13ed797
📒 Files selected for processing (2)
.changeset/olive-cloths-beam.mdpackages/form-core/src/utils.ts
| // Leading `[` may lead to wrong parsing (e.g. '[0][1]' → '0.1', not '.0.1') | ||
| return str | ||
| .replace(/(^\[)|]/g, '') | ||
| .replace(/\[/g, '.') | ||
| .replace(/\.{2,}/g, '.') | ||
| .split('.') | ||
| .map((segment) => { | ||
| const num = parseInt(segment, 10) | ||
| return String(num) === segment ? num : segment | ||
| }) |
There was a problem hiding this comment.
Strip leading-dot paths before splitting.
concatenatePaths can legitimately produce .child when the parent path is empty, but this parser still turns that into ['', 'child']. Downstream, getBy/setBy/deleteBy will then read or write under an empty-string key instead of child.
Suggested fix
return str
+ .replace(/^\./, '')
.replace(/(^\[)|]/g, '')
.replace(/\[/g, '.')
.replace(/\.{2,}/g, '.')
.split('.')
+ .filter(Boolean)
.map((segment) => {
const num = parseInt(segment, 10)
return String(num) === segment ? num : segment
})📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Leading `[` may lead to wrong parsing (e.g. '[0][1]' → '0.1', not '.0.1') | |
| return str | |
| .replace(/(^\[)|]/g, '') | |
| .replace(/\[/g, '.') | |
| .replace(/\.{2,}/g, '.') | |
| .split('.') | |
| .map((segment) => { | |
| const num = parseInt(segment, 10) | |
| return String(num) === segment ? num : segment | |
| }) | |
| // Leading `[` may lead to wrong parsing (e.g. '[0][1]' → '0.1', not '.0.1') | |
| return str | |
| .replace(/^\./, '') | |
| .replace(/(^\[)|]/g, '') | |
| .replace(/\[/g, '.') | |
| .replace(/\.{2,}/g, '.') | |
| .split('.') | |
| .filter(Boolean) | |
| .map((segment) => { | |
| const num = parseInt(segment, 10) | |
| return String(num) === segment ? num : segment | |
| }) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/form-core/src/utils.ts` around lines 156 - 165, The path parser
currently leaves a leading empty segment for paths like ".child" (produced by
concatenatePaths) because it doesn't strip leading dots; update the replace
chain that processes the path (the .replace(/(^\[)|]/g, '')... sequence) to
remove any leading dots before splitting (e.g. add .replace(/^\.+/, '') or
equivalent) so that ".child" becomes "child" and downstream helpers (getBy,
setBy, deleteBy) no longer treat an empty-string key as the first segment.

Summary by CodeRabbit