Skip to content

fix(grid): fix custom setting style error at mobile-first #3524

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

Merged
merged 2 commits into from
Jun 23, 2025

Conversation

gimmyhehe
Copy link
Member

@gimmyhehe gimmyhehe commented Jun 19, 2025

PR

修复多端场景下,自定义设置面板样式错乱

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

  • Refactor
    • Updated modal rendering to explicitly use PC mode for improved platform consistency.
    • Added a clarifying comment regarding modal platform adaptation.
  • Bug Fixes
    • Enhanced grid data fetching method to better handle reload actions and page resets.
  • New Features
    • Marked a form component property as stable starting version 3.15.0.

Copy link

coderabbitai bot commented Jun 19, 2025

Walkthrough

The change updates a Vue component template by adding two attributes, tiny_mode="pc" and tiny_mode_root, to a <tiny-modal> element. A clarifying comment was also added above the modal, explaining the reason for fixing the modal to PC mode due to platform adaptation limitations. Additionally, API definitions were enhanced by adding a meta field to a form property and refining the method signature and description of a grid component method. A fetch method was also updated to simplify API invocation and add clarifying comments without changing its signature.

Changes

File(s) Change Summary
packages/vue/src/grid-toolbar/src/custom-saas.vue Added tiny_mode="pc" and tiny_mode_root attributes to <tiny-modal>; inserted explanatory comment.
examples/sites/demos/apis/form.js Added meta field { stable: '3.15.0' } to the overflow-title boolean property in the form API definition.
examples/sites/demos/apis/grid.js Updated handleFetch method signature to accept (code: "reload") and return Promise<null>; enhanced method description.
packages/vue/src/grid/src/fetch-data/src/methods.ts Simplified handleFetch API call from .apply(this, [params]) to direct call fetchData.api(params); added clarifying comments.

Poem

A modal fixed for PC display,
With attributes set in a tidy array.
Meta tags mark stable ground,
Fetch calls now more sound.
Reload commands clear the way,
The rabbit hops with joy today! 🐇✨

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.

examples/sites/demos/apis/form.js

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/apis/grid.js

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

packages/vue/src/grid/src/fetch-data/src/methods.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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 Jun 19, 2025
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: 1

🧹 Nitpick comments (1)
packages/vue/src/grid-toolbar/src/custom-saas.vue (1)

2-2: Add an English translation for the synchronization comment
The inline Chinese comment helps current contributors, but adding an English version will aid non-Chinese maintainers and ensure consistency across the codebase.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d0959c6 and 3490ba8.

📒 Files selected for processing (1)
  • packages/vue/src/grid-toolbar/src/custom-saas.vue (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

Comment on lines +5 to +6
tiny_mode="pc"
tiny_mode_root
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix prop naming for <tiny-modal> and verify support
Vue component props should use kebab-case in templates. The underscores here may not map to the intended props (tinyMode, tinyModeRoot) on the tiny-modal component and can silently break your fix. Please confirm that these props exist and work as expected, or apply the following diff:

 <tiny-modal
     width="800"
-    tiny_mode="pc"
-    tiny_mode_root
+    tiny-mode="pc"
+    tiny-mode-root
     title=" "
     class="tiny-grid-toolbar-modal"
     v-model="visible"
     @input="handleInput"
     @close="handleClose"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tiny_mode="pc"
tiny_mode_root
<tiny-modal
width="800"
tiny-mode="pc"
tiny-mode-root
title=" "
class="tiny-grid-toolbar-modal"
v-model="visible"
@input="handleInput"
@close="handleClose"
>
🤖 Prompt for AI Agents
In packages/vue/src/grid-toolbar/src/custom-saas.vue at lines 5 to 6, the props
for the <tiny-modal> component are incorrectly named using underscores instead
of kebab-case. Rename the props from tiny_mode and tiny_mode_root to tiny-mode
and tiny-mode-root respectively to match Vue's kebab-case convention for props
in templates. Also verify that these props exist on the tiny-modal component and
function correctly after renaming.

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: 1

🧹 Nitpick comments (1)
packages/vue/src/grid/src/fetch-data/src/methods.ts (1)

40-40: Good observation about API inconsistency.

The comment raises a valid concern about the inconsistent behavior of clearing only single selection state while leaving multi-selection intact during prefetch operations.

Consider creating a task to address this inconsistency in the prefetch behavior for better API consistency.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3490ba8 and 6a4a37d.

📒 Files selected for processing (3)
  • examples/sites/demos/apis/form.js (1 hunks)
  • examples/sites/demos/apis/grid.js (1 hunks)
  • packages/vue/src/grid/src/fetch-data/src/methods.ts (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • examples/sites/demos/apis/form.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (4)
packages/vue/src/grid/src/fetch-data/src/methods.ts (2)

26-28: LGTM! Excellent documentation addition.

The comment clearly explains the technical debt around the sortArg parameter and the rationale for keeping it to avoid breaking changes.


91-91: Verify that the context change doesn't break the API function.

The change from .apply(this, [params]) to direct invocation fetchData.api(params) removes the explicit this binding. If the API function internally relies on this context to refer to the grid component, this could be a breaking change.

Run the following script to check if any API functions might depend on this context:

#!/bin/bash
# Description: Search for fetchData.api implementations that might use 'this' context
# Expected: Find API function implementations and check for 'this' usage

# Search for fetchData.api definitions and implementations
echo "=== Searching for fetchData.api definitions ==="
rg -A 10 -B 5 "fetchData\.api\s*[=:]" --type ts --type js

echo -e "\n=== Searching for API functions that use 'this' ==="
# Look for function definitions that might be used as fetchData.api and use 'this'
rg -A 15 -B 2 "function.*\([^)]*\).*{[^}]*this\." --type ts --type js

echo -e "\n=== Searching for arrow functions assigned to api that capture 'this' ==="
rg -A 10 -B 2 "api\s*:\s*\([^)]*\)\s*=>" --type ts --type js
examples/sites/demos/apis/grid.js (2)

2011-2018: Clarify relationship between API changes and PR objectives.

The PR objectives state this is to "fix custom setting style error at mobile-first", but these changes appear to be API documentation improvements rather than style fixes. Could you clarify:

  1. How these API definition changes relate to fixing mobile-first style issues?
  2. Are there additional files in this PR that contain the actual style fixes?
  3. Is this method signature change required to support the style fixes?

Likely an incorrect or invalid review comment.


2011-2011: ```shell
#!/bin/bash

Search for any definition or invocation of handleFetch across the repository

echo "Searching for handleFetch occurrences in all files..."
rg -n "handleFetch"


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +2014 to 2015
'zh-CN': '触发表格的 fetch-data,当 code="reload" 时会将分支重置为 1,且清除筛选、排序等条件',
'en-US': 'Trigger the fetch-data of the table'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo and improve description consistency.

Two issues identified in the description update:

  1. Typo: "分支重置为 1" should be "分页重置为 1" (reset page index to 1, not branch)
  2. Inconsistency: The Chinese description is now much more detailed than the English description. Consider updating the English description to match.

Apply this fix for the typo:

-            'zh-CN': '触发表格的 fetch-data,当 code="reload" 时会将分支重置为 1,且清除筛选、排序等条件',
+            'zh-CN': '触发表格的 fetch-data,当 code="reload" 时会将分页重置为 1,且清除筛选、排序等条件',

And consider enhancing the English description for consistency:

-            'en-US': 'Trigger the fetch-data of the table'
+            'en-US': 'Trigger the fetch-data of the table. When code="reload", resets page index to 1 and clears filters, sorting, and other conditions'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'zh-CN': '触发表格的 fetch-data,当 code="reload" 时会将分支重置为 1,且清除筛选、排序等条件',
'en-US': 'Trigger the fetch-data of the table'
'zh-CN': '触发表格的 fetch-data,当 code="reload" 时会将分页重置为 1,且清除筛选、排序等条件',
'en-US': 'Trigger the fetch-data of the table. When code="reload", resets page index to 1 and clears filters, sorting, and other conditions'
🤖 Prompt for AI Agents
In examples/sites/demos/apis/grid.js around lines 2014 to 2015, correct the typo
in the Chinese description by changing "分支重置为 1" to "分页重置为 1". Then, update the
English description to match the detail level of the Chinese one by explaining
that triggering fetch-data with code="reload" resets the page index to 1 and
clears filters and sorting conditions.

@zzcr zzcr merged commit a33f861 into dev Jun 23, 2025
9 of 10 checks passed
@zzcr zzcr deleted the cgm/fix-custom-saas-mf branch June 23, 2025 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants