Skip to content

fix(picker): stop the dropdown resizing itself inside its own resize observer - #4295

Merged
Befkadu1 merged 2 commits into
mainfrom
fix/portal-restyle-outside-resize-delivery
Sep 23, 2026
Merged

Befkadu1 merged 2 commits into
mainfrom
fix/portal-restyle-outside-resize-delivery

Conversation

@FredrikWallstrom

@FredrikWallstrom FredrikWallstrom commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

A picker dropdown is laid out at its content's width first, then the portal's ResizeObserver callback writes the anchor's width onto that same container — resizing an observed element from inside its own notification. The browser reports ResizeObserver loop completed with undelivered notifications, which the web client logs as an uncaught error and forwards to Sentry.

Skipping writes that change nothing doesn't cover it: that first width is genuinely new, so there is nothing to skip. Restyling on the next frame keeps the write out of the delivery that asked for it.

Verified by serving this build into the web client in place of the CDN's 40.2.5 and driving a column filter's coworker picker: 1 error before, 0 after.

Fixes Lundalogik/crm-client#1269

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

macOS:

  • Chrome
  • Firefox
  • Safari

Summary by CodeRabbit

  • Bug Fixes
    • Improved portal resizing behavior by coalescing rapid updates into a single visual refresh.
    • Prevented unnecessary updates when no positioning instance is active.
    • Ensured pending visual updates are canceled when the portal is destroyed.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: Lundalogik/lime-elements/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 69b67e8a-4d81-48fc-a3a8-da65627f3a9e

📥 Commits

Reviewing files that changed from the base of the PR and between 7864271 and c45aabb.

📒 Files selected for processing (1)
  • src/components/portal/portal.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Portal now defers and coalesces ResizeObserver restyles in an animation frame. It skips deferred work without a Popper instance and cancels pending frames when Popper is destroyed.

Changes

Portal restyle scheduling

Layer / File(s) Summary
Deferred restyle lifecycle
src/components/portal/portal.tsx
Portal tracks a pending animation frame, schedules coalesced restyles after ResizeObserver notifications, skips updates without a Popper instance, and cancels pending work during Popper destruction.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: kiarokh

Merge Risk: ⚪ Minimal · up to c45aa

The deferred restyle lifecycle is mergeable with no concrete current-head risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the picker dropdown ResizeObserver resizing issue and states that the change fixes it. It accurately summarizes the main purpose of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@github-actions

Copy link
Copy Markdown

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4295/

…observer

With `inheritParentWidth` the restyle writes the anchor's width onto the container the observer
watches, so the first callback resizes it mid-delivery and the browser reports a ResizeObserver
loop. Restyle on the next frame instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@FredrikWallstrom
FredrikWallstrom force-pushed the fix/portal-restyle-outside-resize-delivery branch from 7864271 to b1e960e Compare September 16, 2026 06:23
@FredrikWallstrom
FredrikWallstrom requested review from Kiarokh and removed request for Kiarokh September 16, 2026 06:23

@Befkadu1 Befkadu1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome ⚡

@Befkadu1
Befkadu1 enabled auto-merge (rebase) September 22, 2026 21:20
@Befkadu1
Befkadu1 merged commit 1b0b5c2 into main Sep 23, 2026
33 of 34 checks passed
@Befkadu1
Befkadu1 deleted the fix/portal-restyle-outside-resize-delivery branch September 23, 2026 06:23
@lime-opensource

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 40.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants