Skip to content

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

Open
FredrikWallstrom wants to merge 1 commit into
mainfrom
fix/portal-restyle-outside-resize-delivery
Open

FredrikWallstrom wants to merge 1 commit 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

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: b0c4d5e8-05d5-4ea1-9616-3c493dd0f7c1

📥 Commits

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

📒 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: ➖ Normal

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

Change: Bug fix

Suggested reviewers: kiarokh

Merge Risk: ⚪ Minimal · up to 78642

The picker resize update is deferred without leaving stale positioning work behind, so no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing the picker dropdown from resizing itself during its own ResizeObserver callback.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/portal-restyle-outside-resize-delivery

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant