Skip to content

fix(renderless): restore the removed InfiniteScroll variable #2882

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Feb 11, 2025

Conversation

shenjunjian
Copy link
Collaborator

@shenjunjian shenjunjian commented Feb 11, 2025

PR

还原 InfiniteScroll 指令变量到renderless/common中去

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features
    • Introduced dynamic infinite scroll functionality, allowing content to load more seamlessly as you navigate.
    • Added utility functions for DOM manipulation and event handling, enhancing the module's capabilities.

Copy link

coderabbitai bot commented Feb 11, 2025

Warning

Rate limit exceeded

@shenjunjian has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 36 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 7d8150e and e481208.

📒 Files selected for processing (1)
  • packages/renderless/src/common/deps/infinite-scroll.ts (1 hunks)

Walkthrough

The pull request adds a new dependency on @opentiny/vue-directive in the packages/renderless/package.json file. Additionally, a new file is introduced that imports the InfiniteScroll component from @opentiny/vue-directive and exports it as the default export in the renderless package. Furthermore, utility functions from @opentiny/utils are now exported in the dom.ts file. These changes update dependency management and public API declarations.

Changes

Files Change Summary
packages/renderless/package.json Added dependency "@opentiny/vue-directive": "workspace:~" in the dependencies section
packages/renderless/src/common/deps/infinite-scroll.ts New file importing InfiniteScroll from @opentiny/vue-directive and exporting it as the default module export
packages/renderless/src/common/deps/dom.ts New exports added: on, off, once, hasClass, addClass, removeClass, getStyle, setStyle, isScroll, getScrollContainer, isInContainer, getDomNode, getScrollTop, stopPropagation, preventDefault, getScrollParent, useScrollParent, isDisplayNone from @opentiny/utils

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • zzcr

Poem

I'm a rabbit hopping through the code with flair,
Adding directives with a smooth, light air.
Infinite scroll now leaps into view,
With each line a fresh idea anew.
Cheers from the bunny, in a coding wonderland! 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

@github-actions github-actions bot added the bug Something isn't working label Feb 11, 2025
Copy link

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

Copy link

Walkthrough

此PR将被移除的InfiniteScroll变量还原到renderless/common中。此更改涉及在packages/renderless/src/common/deps/infinite-scroll.ts中重新导入并导出InfiniteScroll变量。

Changes

文件 描述
packages/renderless/package.json 更新了依赖项以支持InfiniteScroll的还原。
packages/renderless/src/common/deps/infinite-scroll.ts 新增文件,导入并导出InfiniteScroll变量。

@@ -0,0 +1,3 @@
import { InfiniteScroll } from '@opentiny/vue-directive'

Choose a reason for hiding this comment

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

确保@opentiny/vue-directive包中确实存在InfiniteScroll导出,以避免运行时错误。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Walkthrough

This PR restores the removed InfiniteScroll variable to renderless/common. This change involves reimporting and exporting the InfiniteScroll variable in packages/renderless/src/common/deps/infinite-scroll.ts.

Changes

Document Description
packages/renderless/package.json Updated dependencies to support InfiniteScroll restore.
packages/renderless/src/common/deps/infinite-scroll.ts Add a new file, import and export the InfiniteScroll variable.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/renderless/src/common/deps/dom.ts (1)

1-20: Consider adding TypeScript types and documentation.

The exported utility functions would benefit from:

  1. TypeScript type declarations for better type safety and IDE support
  2. JSDoc comments describing each function's purpose, parameters, and return values

Consider adding type information and documentation:

+/**
+ * DOM manipulation and event handling utilities
+ * @module dom
+ */
+
+/**
+ * Attaches an event handler to an element
+ * @param {Element} element - The target element
+ * @param {string} event - The event name
+ * @param {Function} handler - The event handler
+ */
export {
  on,
  off,
  // ... add similar documentation for other functions
} from '@opentiny/utils'
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52969fd and 7d8150e.

📒 Files selected for processing (1)
  • packages/renderless/src/common/deps/dom.ts (1 hunks)
🔇 Additional comments (1)
packages/renderless/src/common/deps/dom.ts (1)

1-20: Verify exports from '@opentiny/utils'.

Let's ensure all exported functions are properly defined in the '@opentiny/utils' package.

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check if all exported functions exist in @opentiny/utils

# Search for function definitions in @opentiny/utils
ast-grep --pattern 'export function $name($$$) { $$$ }' | grep -E 'on|off|once|hasClass|addClass|removeClass|getStyle|setStyle|isScroll|getScrollContainer|isInContainer|getDomNode|getScrollTop|stopPropagation|preventDefault|getScrollParent|useScrollParent|isDisplayNone'

Length of output: 272


I'll run a new script to search if these functions might be defined using arrow functions. This will help further verify that the expected exports exist:


🏁 Script executed:

#!/bin/bash
# Search for arrow function export definitions for the expected functions in @opentiny/utils
ast-grep --pattern 'export const $name = ($$$) => $$$' | grep -E 'on|off|once|hasClass|addClass|removeClass|getStyle|setStyle|isScroll|getScrollContainer|isInContainer|getDomNode|getScrollTop|stopPropagation|preventDefault|getScrollParent|useScrollParent|isDisplayNone'

Length of output: 271


The previous scripts didn't return results, likely because the package's exports may not be defined with the patterns we checked. To further verify the dependency, let’s check if the @opentiny/utils package is declared in the root package.json (which gives us confidence that its exported functions are available). We'll run a script for that:


🏁 Script executed:

#!/bin/bash
# Verify that @opentiny/utils is included as a dependency in package.json at the repository root
grep '@opentiny/utils' package.json

Length of output: 35


Let's run a new script that searches for any mention of "@opentiny/utils" in all package.json files within the repository. This will help us verify if the dependency is declared somewhere (for example, in packages/renderless/package.json) even if it's not in the repository root.


🏁 Script executed:

#!/bin/bash
# Search for '@opentiny/utils' in any package.json file in the repository
grep -R '"@opentiny/utils"' .

Length of output: 2880


Review of DOM Re-Export File from '@opentiny/utils'

  • The re-export file in packages/renderless/src/common/deps/dom.ts correctly re-exports the listed DOM utility functions.
  • Our automated searches confirmed that @opentiny/utils is declared as a dependency (via multiple package.json files), which suggests that the package is available.
  • However, automated pattern searches (using both function and arrow function patterns) did not match any explicit definitions. This likely means the utilities are exported using alternative or aggregated patterns in @opentiny/utils.
  • It is advisable to manually verify within the @opentiny/utils package that all functions (on, off, once, etc.) are indeed exported (and that their TypeScript types and documentation—if needed—are provided) to ensure consistency with the intended PR objectives.

@@ -37,6 +37,7 @@
},
"dependencies": {
"@opentiny/utils": "workspace:~",
"@opentiny/vue-directive": "workspace:~",
Copy link
Member

Choose a reason for hiding this comment

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

依赖要删除

@zzcr zzcr merged commit 0a9369b into opentiny:dev Feb 11, 2025
5 checks passed
@shenjunjian shenjunjian deleted the restore-infinitescroll-in-common branch March 10, 2025 11:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants