Skip to content

[backport core/1.40] fix: batch updateClipPath via requestAnimationFrame#9588

Merged
christian-byrne merged 1 commit intocore/1.40from
backport-9173-to-core-1.40
Mar 8, 2026
Merged

[backport core/1.40] fix: batch updateClipPath via requestAnimationFrame#9588
christian-byrne merged 1 commit intocore/1.40from
backport-9173-to-core-1.40

Conversation

@comfy-pr-bot
Copy link
Member

@comfy-pr-bot comfy-pr-bot commented Mar 8, 2026

Backport of #9173 to core/1.40

Automatically created by backport workflow.

┆Issue is synchronized with this Notion page by Unito

## Summary

Batch `getBoundingClientRect()` calls in `updateClipPath` via
`requestAnimationFrame` to avoid forced synchronous layout.

## Changes

- **What**: Wrap the layout-reading portion of `updateClipPath` in
`requestAnimationFrame()` with cancellation. Multiple rapid calls within
the same frame are coalesced into a single layout read. Eliminates
~1,053 forced synchronous layouts per profiling session.

## Review Focus

- `getBoundingClientRect()` forces synchronous layout. When interleaved
with style mutations (from PrimeVue `useStyle`, cursor writes, Vue VDOM
patching), this creates layout thrashing — especially in Firefox where
Stylo aggressively invalidates the entire style cache.
- The RAF wrapper coalesces all calls within a frame into one, reading
layout only once per frame. The `cancelAnimationFrame` ensures only the
latest parameters are used.
- `willChange: 'clip-path'` is included to hint the browser to optimize
clip-path animations.

## Stack

4 of 4 in Firefox perf fix stack. Depends on #9170.

<!-- Fixes #ISSUE_NUMBER -->

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9173-fix-batch-updateClipPath-via-requestAnimationFrame-3116d73d3650810392f7fba7ea5ceb6f)
by [Unito](https://www.unito.io)
@comfy-pr-bot comfy-pr-bot requested a review from a team as a code owner March 8, 2026 02:32
@comfy-pr-bot comfy-pr-bot added the backport Backporting a PR onto a release candidate label Mar 8, 2026
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 8, 2026
@github-actions
Copy link

github-actions bot commented Mar 8, 2026

Playwright: 🕵🏻 0 passed, 0 failed

📊 Browser Reports
  • chromium: ❌ Deployment failed
  • chromium-2x: ❌ Deployment failed
  • chromium-0.5x: ❌ Deployment failed
  • mobile-chrome: ❌ Deployment failed

@github-actions
Copy link

github-actions bot commented Mar 8, 2026

🎨 Storybook Build Status

Build failed!

⏰ Completed at: 03/08/2026, 02:33:24 AM UTC

🔗 Links


⚠️ Please check the workflow logs for error details.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13f84dd0-fe1e-41f7-b2a2-279fd4d17f90

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch backport-9173-to-core-1.40

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.

@christian-byrne christian-byrne merged commit 5c2a8b7 into core/1.40 Mar 8, 2026
19 of 25 checks passed
@christian-byrne christian-byrne deleted the backport-9173-to-core-1.40 branch March 8, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Backporting a PR onto a release candidate size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants