-
Notifications
You must be signed in to change notification settings - Fork 354
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
fix: handleTinyGridColumnsSlots方法中node.props.columns不是数组时造成页面无法加载问题 #1163
base: develop
Are you sure you want to change the base?
The head ref may contain hidden characters: "handleTinyGridColumnsSlots\u65B9\u6CD5\u4E2Dcolumns\u4E0D\u662F\u6570\u7EC4\u65F6\u9020\u6210\u65E0\u6CD5\u52A0\u8F7D\u9875\u9762\u95EE\u9898"
fix: handleTinyGridColumnsSlots方法中node.props.columns不是数组时造成页面无法加载问题 #1163
Conversation
WalkthroughThis pull request updates the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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
packages/canvas/DesignCanvas/src/api/useCanvas.jsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin". (The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/packages/canvas".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "packages/canvas/.eslintrc.cjs » @vue/eslint-config-typescript". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/canvas/DesignCanvas/src/api/useCanvas.js
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: push-check
let columns = node.props?.columns && Array.isArray(node.props?.columns) ? node.props.columns : [] | ||
for (const columnItem of columns) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good defensive programming to fix loading issue.
The addition of the Array.isArray
check is a solid fix for the bug described in the PR. This prevents runtime errors when node.props.columns
exists but isn't an array (e.g., if it's an object or primitive value), which would cause the page to fail to load when attempting to iterate over a non-iterable value.
This solution properly handles edge cases while maintaining the original functionality.
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
node.props.columns不是数组时,会发生异常无法加载页面, 修改判断逻辑,增加 Array.isArray 类型判断
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information