Skip to content

Conversation

@AchoDev
Copy link

@AchoDev AchoDev commented Nov 18, 2025

(transition):

Like the title said, when you open your dev tools and navigate to the "animation" tab, you can slow down all animations globally. This is very useful for testing animations with a very fine lense, when something just looks off to the naked eye. Anyway, this doesn't work when the component leaves, because it will be removed from the DOM too early. This pull request fixes that.

See it for yourself:
https://play.vuejs.org/#eNp9VM1u00AQfpWpUVWQEicFejFuRUE9wAEQVOLiy8Ye29tsvKvdsZOoyrszu+u4Kaqa5LDz9803f3lMbo1Jhx6TLMldaaUhcEi9uSk6uTHaEjyCxRoOUFu9gQt2vSg6/y115whIN41CuPZOb2uhHL7zxnwRwRiGBcKNUYIwSAB5e3lzy/CCpO5g1Tf5gjWjzWcG/vxtsYO97sFYdA6oRfYk4oAiiUmLBFao9HYGAlZ6B1upFMRgYQwKyxpq2UhWdE6GZFVvY1ZdA+5ESWoPV8vlxqVw30oHW23XDoQDSRHJtbpX1cznBlkHQtowswoHrl0rdu4q6MQgGy6QVYFpkYhjfcySxGqkxa6OGUOltx0Ipju5cYUa3l+dg7ZwuTyf+UwX7OCQQX3tSpfriFJJF+vzMRr4ofZp6N3CNy+8xlZ9LpUs19fHjvGYzo69G9s8iiE6Bk0Q9oZVNvidCEG8nzo6wuSVHGCYy3rKxXXLiqWpwjkJ2yBNmTm37zj/Tic0wi0YL2ZePMuVL57tUu5or/zzzf9p4NFHGx0jMxArp1VP+MmrFdaUwdLsgrQS5bqxuu+qDIxQOEitkCxWwbqVFbUZz+To3qJsWg5/0vBAmNI+g8bKGMRiiXPJXF0GJXaElvUHTzkd5kGe8/LJAWdBo1AMOGoi86eOMNH0yvGYnSf/HMPf5CkC71CI1kaUkpjR8qTeQBjO4lmLjo5ofKtjF5NZQo7vupZN+uB0x38KAa5ISr0xUqH9acKyFkkWE3kb77Hefg86sr2vKOrLFsv1C/oHt/O6IvnFl4124FWZbMcd8ea7Pz9wx+/JuNFV7xfrFeNvDGMOd+fdvvBUmfaJX2D7LfRAds29u9sRcqfHojxR73kI/kXCf3dfXyn9ie6H9GOI454mh3/Y1M2n

Summary by CodeRabbit

  • Refactor
    • Transition end detection now uses a more precise animation-frame driven mechanism for timing.
  • Bug Fix
    • Fixes intermittent transition hang/early termination so visual transitions complete more reliably, resulting in smoother UI animations.

@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Walkthrough

Replaces the setTimeout fallback in whenTransitionEnds with a requestAnimationFrame-driven polling loop that checks elapsed time and triggers end() when the timeout threshold is reached.

Changes

Cohort / File(s) Summary
Transition timing fallback refactor
packages/runtime-dom/src/components/Transition.ts
Removed setTimeout short-circuit fallback and added a RAF-based fallbackTimeout loop that polls elapsed time and invokes end() when timeout + 1 is exceeded (runs unconditionally as the new fallback path).

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant App as Application
    participant whenTE as whenTransitionEnds
    participant Events as transition/animation events
    participant RAF as requestAnimationFrame loop

    App->>whenTE: whenTransitionEnds(el, timeout)
    whenTE->>Events: attach end event listeners
    Events-->>whenTE: end events fire (maybe)
    rect rgb(240,248,255)
      Note over whenTE,RAF: New flow — RAF polling fallback
      whenTE->>RAF: start fallbackTimeout (rAF loop)
      loop per frame
        RAF->>RAF: check elapsed >= timeout + 1 ?
        alt timeout reached
          RAF-->>whenTE: call end()
          RAF-->>whenTE: stop loop
        else continue
          RAF->>RAF: request next rAF
        end
      end
    end
    whenTE->>App: end() (from events or RAF)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Small, localized change in one file replacing a single timing mechanism.
  • Pay attention to:
    • Correct termination of the RAF loop to avoid leaks.
    • Equivalence of timing (uses timeout + 1) vs prior setTimeout behavior.
    • Cases with multiple transitioned properties and event counting.

Possibly related issues

Suggested labels

ready to merge, scope: transition, :hammer: p3-minor-bug

Poem

🐰 I hopped from timeout's ticking chime,
To frames that hum in steady time,
I watch each frame, no sudden end,
Frame by frame, the transitions mend,
A soft, precise and bouncy rhyme. 🥕✨

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 title directly describes the main fix: preventing from completing too early when animation speed is slowed in dev tools, which matches the core change from setTimeout to RAF-based fallback timing.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94afbc8 and 600eb01.

📒 Files selected for processing (1)
  • packages/runtime-dom/src/components/Transition.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime-dom/src/components/Transition.ts

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.

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/runtime-dom/src/components/Transition.ts (1)

381-385: Remove commented-out code.

The old setTimeout-based implementation is preserved in git history and doesn't need to remain as comments.

Apply this diff:

- // setTimeout(() => {
- //   if (ended < propCount) {
- //     end()
- //   }
- // }, timeout + 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 3942dbe and 94afbc8.

📒 Files selected for processing (1)
  • packages/runtime-dom/src/components/Transition.ts (1 hunks)

@edison1105 edison1105 changed the title fix(#14112): Fixed <Transition> completing too early when slowing down animation speed in browser dev tools fix(Transition): fixed transition completing too early when slowing down animation speed in browser dev tools Nov 18, 2025
@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 103 kB (+135 B) 38.9 kB (+52 B) 35.1 kB (+29 B)
vue.global.prod.js 161 kB (+135 B) 58.9 kB (+44 B) 52.5 kB (+100 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.9 kB 18.3 kB 16.8 kB
createApp 55 kB 21.4 kB 19.6 kB
createSSRApp 59.3 kB 23.1 kB 21.1 kB
defineCustomElement 60.6 kB 23.1 kB 21.1 kB
overall 69.5 kB (+135 B) 26.7 kB (+52 B) 24.3 kB (-3 B)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants