-
-
Notifications
You must be signed in to change notification settings - Fork 280
fix: getFieldsValue can not get fully store #774
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@zombieJ has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 44 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ 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 |
Summary of ChangesHello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #774 +/- ##
=======================================
Coverage 99.53% 99.54%
=======================================
Files 19 19
Lines 1291 1311 +20
Branches 324 329 +5
=======================================
+ Hits 1285 1305 +20
Misses 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Code Review
This pull request addresses an issue where getFieldsValue failed to retrieve the complete store for list structures. The fix involves enhancing getFieldsValue to recursively fetch all nested fields under a specified path, which is a solid approach. The changes in NameMap.ts and useForm.ts are logical and correctly implemented, and a new test case validates this fix. Additionally, a new Screen component has been introduced to conditionally render form elements with animation, complete with documentation and examples. My review highlights a potential issue with the animation in the new Screen component and a minor typo in the new test. Overall, the pull request is well-executed and effectively resolves the stated problem.
src/Screen/index.tsx
Outdated
| const screenStyle: React.CSSProperties = { | ||
| transition: 'opacity 0.3s, transform 0.3s', | ||
| opacity: visible ? 1 : 0, | ||
| transform: visible ? 'scale(1)' : 'scale(0.8)', | ||
| display: visible ? 'block' : 'none', | ||
| ...style, | ||
| }; |
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.
The fade-in animation may not work as expected due to the use of display: 'none'. When visible becomes true, the display property changes from none to block and opacity changes to 1 within the same render cycle. The browser doesn't have a 'from' state to transition from, so the element will appear instantly rather than fading in. The fade-out animation will work correctly.
To achieve a proper fade-in animation while still using display: 'none' (presumably to unmount fields), you would typically need a more complex implementation involving useEffect and timeouts to manage rendering and style changes in separate phases, or use a library like react-transition-group. If an instant appearance on 'show' is acceptable, then this implementation is fine.
| generateForm( | ||
| fields => | ||
| fields.map(field => ( | ||
| <Field {...fields} name={[field.name, 'name']} key={field.key}> |
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.
There appears to be a typo in this line. You are spreading fields (the array of ListField objects) as props to the Field component, instead of field (the individual ListField object from the map iteration). While the test might still pass because name and key are explicitly provided, spreading the fields array is incorrect and could pass unexpected props to the Field component.
| <Field {...fields} name={[field.name, 'name']} key={field.key}> | |
| <Field {...field} name={[field.name, 'name']} key={field.key}> |
|
一开始也想往这方向改来着😂 |
fix ant-design/ant-design#56265