-
-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support escaped paths in field name #551
feat: support escaped paths in field name #551
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
packages/form-core/src/utils.ts
Outdated
// key difference from lodash string to path algoritm | ||
if ((/^\d+$/).test(key)) { | ||
key = parseInt(key, 10); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main modification I made based on the previous logic in makePathArray
.
This looks good overall! The only concern I have now is typings. We'll want a way to merge the types from https://github.com/crutchcorn/ts-util-helpers/blob/main/src/concat-string.ts#L1-L7 But then the question becomes "how do we get |
Not sure I get this part of your comment. Where are you referring to the
Just to make sure I get what you're referring to. You're referring to making sure that the form/packages/form-core/src/utils.ts Line 299 in 77f119b
[''] syntax, right? I'll look in this.
|
I wouldn't modify |
88ce14c
to
5463b69
Compare
5463b69
to
26b7d61
Compare
66897bc
to
d778e69
Compare
Added spec updates and also utilities as discussed. Ready for comment/review. |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #551 +/- ##
==========================================
- Coverage 87.78% 87.65% -0.14%
==========================================
Files 31 31
Lines 819 826 +7
Branches 184 187 +3
==========================================
+ Hits 719 724 +5
- Misses 95 97 +2
Partials 5 5 ☔ View full report in Codecov by Sentry. |
Hey, I am super sorry - but we've made drastic changes to the internals of these files. It's honestly better to close out this PR and revisit them. I think our types support this now, but our logic certainly doesn't. Let's track the progress of this in: #639 Feel free to open a new PR with the conflicts resolved if you're up for the task. I'll make sure we review it much sooner - I apologize for the crossed wires here. Arrays were in a really bad spot anyway |
Attempts to address #532 .
This is a sketch implementation for feedback, using lodash's internals for get.
Happy to roll a custom implementation but I thought of using an existing battle-tested implementation.
This implementation handles some of the cases in https://github.com/lodash/lodash/blob/main/test/toPath.spec.js .