feat: infiniteloading default scroll
🤔 这个变动的性质是?
- [ 1] 新特性提交
- [ ] 日常 bug 修复
- [ ] 站点、文档改进
- [ ] 演示代码改进
- [ ] 组件样式/交互改进
- [ ] TypeScript 定义更新
- [ ] 包体积优化
- [ ] 性能优化
- [ ] 功能增强
- [ ] 国际化改进
- [ ] 重构
- [ ] 代码风格优化
- [ ] 测试用例
- [ ] 分支合并
- [ ] 其他改动(是关于什么的改动?)
🔗 相关 Issue
💡 需求背景和解决方案
提供设置默认滚动距离的能力
☑️ 请求合并前的自查清单
⚠️ 请自检并全部勾选全部选项。⚠️
- [1 ] 文档已补充或无须补充
- [ 1] 代码演示已提供或无须提供
- [ 1] TypeScript 定义已补充或无须补充
- [ 1] fork仓库代码是否为最新避免文件冲突
- [ 1] Files changed 没有 package.json lock 等无关文件
Summary by CodeRabbit
- 新功能
- InfiniteLoading 组件新增了一个可选属性
defaultScrollTop,允许用户设置加载时的默认滚动位置,从而改善滚动体验。
- InfiniteLoading 组件新增了一个可选属性
- 文档
- 更新了组件文档,详细描述了
defaultScrollTop属性的类型和用途。
- 更新了组件文档,详细描述了
Walkthrough
本次变更为 InfiniteLoading 组件新增了一个可选属性 defaultScrollTop(类型为 number),用于设定组件的默认滚动位置。文档部分也进行了相应的更新以说明该属性的用途。在组件实现中,通过新增的 useEffect 钩子,在 defaultScrollTop 变化时调整滚动位置,从而整合到组件生命周期内。
Changes
| File(s) | Change Summary |
|---|---|
src/packages/infiniteloading/doc.mdsrc/packages/infiniteloading/infiniteloading.tsx |
为 InfiniteLoading 添加了新的可选属性 defaultScrollTop (number)。文档中描述了该属性,组件代码中在接口中声明并通过 useEffect 钩子来更新滚动位置。 |
Sequence Diagram(s)
sequenceDiagram
participant IL as InfiniteLoading 组件
participant Hook as useEffect 钩子
participant DOM as 滚动元素 (scrollEl)
IL->>Hook: 接收 defaultScrollTop 属性
Hook->>DOM: 计算子元素高度
Hook->>DOM: 在超时后更新 scrollTop 为 defaultScrollTop
Possibly related PRs
- jdf2e/nutui-react#2441: 此 PR 也对
InfiniteLoadingProps接口进行了扩展,新增了其他属性,与本次变更在代码级别上具有较强的关联性。
Suggested reviewers
- oasis-cloud
Poem
我是一只快乐的小兔子,
跳跃在代码的花园里。
新增的属性如晨曦般明亮,
滚动动作为页面点缀新意。
在这数字世界里欢欣鼓舞,
代码与梦想齐飞,共舞不停!
[!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.
ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS Optional dependencies cannot be installed without production dependencies
[!TIP]
⚡🧪 Multi-step agentic review comment chat (experimental)
- We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments. - To enable this feature, set early_access to true under in the settings.
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 090a9fec98473f2be5a4dded3959bcfa607718cf and b2c43e7f2b99fb78c1a087addd9213bb2f21c2ed.
📒 Files selected for processing (1)
src/packages/infiniteloading/infiniteloading.tsx(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/packages/infiniteloading/infiniteloading.tsx
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
Attention: Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
Project coverage is 85.54%. Comparing base (
994800f) to head (090a9fe). Report is 2 commits behind head on next.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/packages/infiniteloading/infiniteloading.tsx | 40.00% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## next #3010 +/- ##
==========================================
- Coverage 85.56% 85.54% -0.02%
==========================================
Files 267 267
Lines 18003 18013 +10
Branches 2726 2729 +3
==========================================
+ Hits 15405 15410 +5
- Misses 2595 2600 +5
Partials 3 3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: 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.
ci 问题可以先修复一下
ci 问题可以先修复一下
已修复