Skip to content

Conversation

@zombieJ
Copy link
Member

@zombieJ zombieJ commented Jan 4, 2026

@vercel
Copy link

vercel bot commented Jan 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
field-form Ready Ready Preview, Comment Jan 4, 2026 9:45am

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 31ef0b7 and 425d119.

📒 Files selected for processing (3)
  • src/hooks/useForm.ts
  • src/utils/NameMap.ts
  • tests/list.test.tsx

Note

Other AI code review bot(s) detected

CodeRabbit 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)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-list

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 rc-field-form where the getFieldsValue method failed to retrieve complete form data, particularly for deeply nested structures or lists. The fix involves refining the internal field entity lookup mechanism to correctly identify and include all relevant fields. Additionally, a new Screen component has been introduced, offering a simple way to conditionally render content with basic animation effects, complete with its own documentation and usage example.

Highlights

  • Bug Fix for getFieldsValue: Resolved an issue where getFieldsValue could not retrieve the full store, especially for nested fields, by enhancing field entity retrieval logic.
  • New Screen Component: Introduced a new Screen component for conditional rendering with simple fade-in/out animations, along with its documentation and an example.
  • Enhanced Field Retrieval Logic: Modified FormStore to support retrieving field entities based on name path prefixes, crucial for getFieldsValue to capture all relevant data.
  • New NameMap Utility Method: Added getAsPrefix to NameMap to efficiently retrieve values by key prefix, supporting the improved field retrieval.
  • New Test Case: Added a test to ensure getFieldsValue correctly handles nested list data.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (31ef0b7) to head (425d119).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines 12 to 18
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,
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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}>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
<Field {...fields} name={[field.name, 'name']} key={field.key}>
<Field {...field} name={[field.name, 'name']} key={field.key}>

@QDyanbing
Copy link
Contributor

一开始也想往这方向改来着😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Form.List 添加然后重置,form.getFieldsValue() 返回的 values 不正确

3 participants