-
Notifications
You must be signed in to change notification settings - Fork 437
Fix/element not found develop:Add condition for when element is null #1689
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
base: develop
Are you sure you want to change the base?
Fix/element not found develop:Add condition for when element is null #1689
Conversation
WalkthroughThe changes include a behavioral modification to element duration time calculation logic and stylistic refactoring of filter predicates across two Vue components. The container module now defaults to a 50ms delay and short-circuits when elements are not found, while application and template center modules adopt the more explicit Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
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/workspace/template-center/src/Main.vue (1)
173-173: Stylistic change to useBoolean()function.The change from
!!valuetoBoolean(value)is functionally equivalent—both filter out falsy values. This is purely a stylistic preference for explicitness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/canvas/container/src/container.ts(1 hunks)packages/workspace/application-center/src/Main.vue(1 hunks)packages/workspace/template-center/src/Main.vue(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1226
File: packages/canvas/container/src/components/CanvasDivider.vue:184-185
Timestamp: 2025-03-19T03:13:51.520Z
Learning: The CSS bug in packages/canvas/container/src/components/CanvasDivider.vue where verLeft already includes "px" but is being appended again in the style object will be fixed in a future update, as confirmed by gene9831.
📚 Learning: 2025-01-14T08:45:57.032Z
Learnt from: rhlin
Repo: opentiny/tiny-engine PR: 1011
File: packages/canvas/render/src/application-function/global-state.ts:12-25
Timestamp: 2025-01-14T08:45:57.032Z
Learning: The code in `packages/canvas/render/src/application-function/global-state.ts` is migrated from an existing codebase and should be handled with care when making modifications.
Applied to files:
packages/canvas/container/src/container.ts
📚 Learning: 2025-01-14T08:44:09.485Z
Learnt from: rhlin
Repo: opentiny/tiny-engine PR: 1011
File: packages/canvas/render/src/canvas-function/controller.ts:1-7
Timestamp: 2025-01-14T08:44:09.485Z
Learning: Type safety improvements for the controller in `packages/canvas/render/src/canvas-function/controller.ts` should be deferred until the data structure is finalized.
Applied to files:
packages/canvas/container/src/container.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: push-check
🔇 Additional comments (2)
packages/workspace/application-center/src/Main.vue (1)
194-199: LGTM - Consistent stylistic improvement.The change from
!!valuetoBoolean(value)mirrors the same refactor intemplate-center/src/Main.vue, providing consistency across the codebase. Functionally equivalent.packages/canvas/container/src/container.ts (1)
471-475: Good defensive fix for missing elements.Initializing
delayTimeto 50ms and returning early when the element isnullprevents a crash when callinggetComputedStyleon a non-existent element. This properly handles cases where an elementId exists but the corresponding DOM element cannot be found (e.g., teleport or fragment components).The 50ms default is reasonable for transition timing.
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?
elementId存在但是找不到对应的element元素,例如teleport 或者是 顶层是 fragment 的元素
Issue Number: N/A
What is the new behavior?
如果在elementId找不到对应的元素,则直接return默认的delay毫秒50ms
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit