Skip to content

Conversation

@betterdancing
Copy link
Contributor

@betterdancing betterdancing commented Oct 31, 2025

English | 简体中文

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)
  • Built its own designer, fully self-validated

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:

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?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of missing elements in duration calculations with optimized default timing behavior.

@github-actions github-actions bot added bug Something isn't working release merge to release/ branch, before release period labels Oct 31, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Warning

Rate limit exceeded

@betterdancing has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 40 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 6fe8623 and c335dd4.

📒 Files selected for processing (1)
  • packages/canvas/container/src/container.ts (2 hunks)

Walkthrough

The getElementDurationTime function in the canvas container was modified to return early with a 50ms default delay when the target element is not found, instead of proceeding with duration computation. Valid elements continue using the existing logic.

Changes

Cohort / File(s) Summary
Canvas Container Duration Logic
packages/canvas/container/src/container.ts
Modified getElementDurationTime to default delayTime to 50ms and return immediately when target element is missing, rather than continuing to compute durations

Sequence Diagram

sequenceDiagram
    participant Caller
    participant getElementDurationTime
    participant DOM

    rect rgb(240, 248, 255)
    Note over Caller,DOM: Old Behavior (no early return)
    Caller->>getElementDurationTime: query element
    getElementDurationTime->>DOM: find element
    DOM-->>getElementDurationTime: not found (null)
    getElementDurationTime->>getElementDurationTime: proceed with duration computation
    getElementDurationTime-->>Caller: computed value
    end

    rect rgb(230, 245, 220)
    Note over Caller,DOM: New Behavior (with early return)
    Caller->>getElementDurationTime: query element
    getElementDurationTime->>DOM: find element
    DOM-->>getElementDurationTime: not found (null)
    getElementDurationTime-->>Caller: return 50ms (default)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify existing callers handle the early return correctly
  • Confirm the 50ms default is appropriate for all use cases
  • Check if test coverage exists for the missing element scenario

Poem

🐰 A swift return when paths don't align,
Fifty milliseconds, a graceful design,
No more wandering through absent nodes,
Early exits smooth the coded roads! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Fix/element not found: Add condition for when element is null" directly addresses the core change described in the file summary and PR objectives. The title explicitly mentions "element not found" and "condition for when element is null," which accurately reflects the main change: adding a condition to handle cases where an elementId exists but the corresponding DOM element cannot be resolved, causing the function to return the default delay value of 50ms. The title is concise, specific, and clearly conveys the primary change to a teammate reviewing the history.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@betterdancing betterdancing changed the title Fix/element not found:Add condition for when element is null Fix/element not found v2.7:Add condition for when element is null Oct 31, 2025
Copy link
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 137e4b0 and 6fe8623.

📒 Files selected for processing (1)
  • packages/canvas/container/src/container.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1041
File: packages/plugins/datasource/src/DataSourceList.vue:138-138
Timestamp: 2025-01-14T10:06:25.508Z
Learning: PR #1041 in opentiny/tiny-engine is specifically for reverting Prettier v3 formatting to v2, without any logical code changes or syntax improvements.
📚 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working release merge to release/ branch, before release period

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant