-
Notifications
You must be signed in to change notification settings - Fork 341
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: resolve some schema update issue #956
fix: resolve some schema update issue #956
Conversation
1. 调整画布宽度时,画布选中框不及时更新的 bug 2. 空页面的时候,拖拽组件到画布提示两次新建页面的 bug 3. importSchema 的时候,清空选择 4. 页面 schema 保存的时候,设置保存状态为 false 5. 增强 AdvanceConfig 配置对 props 的容错
WalkthroughThis pull request introduces several modifications across different components in the canvas and settings modules. The changes primarily focus on enhancing state management, improving error handling, and refining user interaction logic. Key modifications include updating conditional logic in the design canvas, clearing canvas selections during schema import, adding responsiveness to canvas resizing, and improving schema saving mechanisms. The changes aim to make the application more robust and responsive to user actions. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 0
🧹 Nitpick comments (1)
packages/settings/events/src/components/AdvanceConfig.vue (1)
138-138
: Consider providing a fallback forschema.props
to avoid potential undefined behavior.Optional chaining prevents runtime errors if
schema.props
is nullish, but you might still end up with anundefined
value fornewPropsKey
. If subsequent code relies onnewPropsKey
to be a valid object or string, it may cause issues. A simple fallback could be used if that aligns with the intended behavior:- let newPropsKey = schema.props?.key + let newPropsKey = schema.props?.key ?? ''
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/canvas/DesignCanvas/src/DesignCanvas.vue
(1 hunks)packages/canvas/DesignCanvas/src/api/useCanvas.js
(1 hunks)packages/canvas/container/src/components/CanvasResize.vue
(2 hunks)packages/plugins/schema/src/Main.vue
(1 hunks)packages/settings/events/src/components/AdvanceConfig.vue
(1 hunks)
🔇 Additional comments (5)
packages/canvas/container/src/components/CanvasResize.vue (2)
14-14
: Consider code consistency by grouping imports or splitting them.
While there is no pressing issue here, in larger codebases it might be beneficial to keep related hooks or functionalities grouped for readability. The current approach is acceptable, but consider adopting a consistent style across the project.
109-116
: Ensure error handling for updateRect
calls.
The asynchronous watcher triggers updateRect
after nextTick()
. If canvasApi.value
is not properly initialized or changed, this call may fail silently. Consider adding checks or error handling to track potential issues.
packages/canvas/DesignCanvas/src/DesignCanvas.vue (1)
102-102
: Validate condition for historyState?.index === 0
.
By adding useHistory().historyState?.index === 0
to the condition, you're bypassing the confirmation modal if the user is on the initial state. Double-check that this logic works as intended, because it could skip important warnings when the user first modifies the canvas.
packages/plugins/schema/src/Main.vue (1)
105-109
: Check downstream effects of calling setSaved(false)
immediately after schema import.
After calling importSchema(value)
, marking the schema as unsaved may cause additional UI prompts. Ensure that this aligns with the intended workflow, especially when quickly making multiple imports or partial changes.
packages/canvas/DesignCanvas/src/api/useCanvas.js (1)
521-522
: Clear canvas selection for a consistent user experience.
Calling clearSelect
after importing a schema is a neat improvement that prevents accidental manipulations of pre-existing selections. Ensure that other events tied to selection states (e.g., metrics or analytics) also reset properly, if applicable.
* fix: resolve some schema update issue 1. 调整画布宽度时,画布选中框不及时更新的 bug 2. 空页面的时候,拖拽组件到画布提示两次新建页面的 bug 3. importSchema 的时候,清空选择 4. 页面 schema 保存的时候,设置保存状态为 false 5. 增强 AdvanceConfig 配置对 props 的容错 * fix: updateRect async change to callback style * fix: first time enter app should show empty page warning
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
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Bug Fixes
setLoopKey
method with optional chaining.