Skip to content

demo: update demo - #795

Merged
li-jia-nan merged 1 commit into
masterfrom
FC-16
Jun 16, 2026
Merged

li-jia-nan merged 1 commit into
masterfrom
FC-16

Conversation

@li-jia-nan

@li-jia-nan li-jia-nan commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

文档

  • 更新了 useForm 示例代码排版格式,增强文档可读性
  • 将多个示例代码(布局、渲染道具、性能验证)从类组件重构为函数组件,展示现代化的 React 编写方式

Copilot AI review requested due to automatic review settings June 16, 2026 04:11
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
field-form Error Error Jun 16, 2026 4:11am

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d1ae489d-f526-442d-bbfc-75c37644ee80

📥 Commits

Reviewing files that changed from the base of the PR and between 36b95d8 and 72ac587.

📒 Files selected for processing (4)
  • README.md
  • docs/examples/layout.tsx
  • docs/examples/renderProps.tsx
  • docs/examples/validate-perf.tsx

Walkthrough

将 docs/examples/ 下的三个示例文件(layout.tsx、renderProps.tsx、validate-perf.tsx)从 React.Component 类组件重构为 React.FC 函数组件,移除 state 与 render() 方法,validate-perf.tsx 额外引入 useRef 持有表单实例。README.md 同步删除一处多余空行。

Changes

文档示例类组件 → 函数组件重构

Layer / File(s) Summary
layout 与 renderProps 示例转为函数组件
docs/examples/layout.tsx, docs/examples/renderProps.tsx
两个示例的 Demo 类组件改写为 React.FC 函数组件,移除 state 与 render() 方法,JSX 结构不变,导出方式改为末尾 export default Demo。
validate-perf 示例转为函数组件(含 useRef 与类型导入)
docs/examples/validate-perf.tsx
更新 rc-field-form 导入,新增 FormProps 类型导入;Demo 改为函数组件,以 useRef<FormInstance> 持有表单实例,事件处理器从类方法迁移为函数内回调,Reset 按钮通过 formRef.current?.resetFields() 触发。
README 示例排版微调
README.md
删除 useForm 章节类组件示例中 setRef 与 render() 之间的一处多余空行。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • zombieJ

Poem

🐇 跳出旧壳 class 已成历史,
FC 函数轻盈登场啦,
useRef 握住表单小把手,
render() 退休,state 回家,
文档示例焕然一新,
小兔我拍掌 🎉 喝彩啊~

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch FC-16

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

@codecov

codecov Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (36b95d8) to head (72ac587).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #795   +/-   ##
=======================================
  Coverage   99.54%   99.54%           
=======================================
  Files          20       20           
  Lines        1328     1328           
  Branches      325      309   -16     
=======================================
  Hits         1322     1322           
  Misses          6        6           

☔ View full report in Codecov by Harness.
📢 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 refactors several example components from class-based to functional components using React hooks. The review feedback highlights opportunities to clean up unused code in layout.tsx, correct the type of formRef to FormRef in validate-perf.tsx, throw standard Error objects in the password validator, and optimize error checking by using Array.prototype.some instead of filter.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docs/examples/layout.tsx
Comment thread docs/examples/validate-perf.tsx
Comment thread docs/examples/validate-perf.tsx
Comment thread docs/examples/validate-perf.tsx

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the documentation/demo examples to modern React/TypeScript patterns (function components + type-only imports) while keeping the showcased rc-field-form behaviors intact.

Changes:

  • Removes an extraneous blank line in the README demo snippet.
  • Refactors several demo components from class-based to functional components.
  • Converts some value imports to import type for cleaner TS output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
README.md Cleans up formatting in the ref example snippet.
docs/examples/validate-perf.tsx Refactors the high-perf validation demo to a function component and adjusts TS imports/handlers.
docs/examples/renderProps.tsx Refactors the render-props demo to a function component.
docs/examples/layout.tsx Refactors the layout/state demo to a function component.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/examples/validate-perf.tsx
@li-jia-nan
li-jia-nan merged commit 63df130 into master Jun 16, 2026
12 of 14 checks passed
@li-jia-nan
li-jia-nan deleted the FC-16 branch June 16, 2026 04:13

This branch had an error being deployed

1 failed deployment
Preview — 72ac5877 Deployed Jun 16, 2026 by vercel[bot]
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.

2 participants