resizable: Fix panel resizing flickering - #2907
Conversation
| // until the current effect cycle has completed. Otherwise | ||
| // the settling frame can remain pending until pointer input | ||
| // triggers a repaint, making the divider jump on hover. | ||
| window.defer(cx, |window, _| window.refresh()); |
There was a problem hiding this comment.
This obviously is a monkey patch, not a really to solve the root problem.
…ow refresh `window.refresh()` sets `Window::refreshing`, which disables the view element cache for the whole window, so every `.cached(...)` view re-renders and re-lays-out on the settling frame. The dock renders its tab panels that way and builds its splits from resizable groups, so the cost lands exactly where resizables are used most. A deferred `cx.notify()` on the state entity schedules the same settling frame without touching that cache: `invalidate_view` marks the window dirty once the draw has finished, and a cached view still re-renders when its own bounds change. Measured on a `.cached(...)` sibling view, a container resize goes from one forced re-render to none. The comment is corrected too. A refresh raised mid-draw is not coalesced into that draw, it is dropped by the `not_drawing()` guard; and a notify raised mid-draw records the view as dirty without scheduling a frame, which is why the deferral is what makes either one work. Adds a regression test for the `with_state` path the dock takes, which has no `use_keyed_state` observer behind it to turn a state change into a redraw. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UezrY94M8EFhB5r1w1Rn3S
|
I pushed a follow-up commit to this branch (
A deferred I also corrected the comment. A refresh raised mid-draw is not coalesced into that draw — One addition: the group's state can come from Two things I did not change, for you to decide:
🤖 Review assisted by Claude Code |
Description
It seems after the
gpui-baseseparation, resizing a panel then repaint can cause a flickering in the UI. The fix schedules a repaint after container size adjusted after current draw cycle.Be
Screenshot
Before
Screen.Recording.2026-09-02.at.10.19.53.AM.mov
After
Screen.Recording.2026-09-02.at.10.30.32.AM.mov
Break Changes
NA
How to Test
mixed_sizing_is_stable_between_resize_and_followup_frameChecklist
cargo runfor story tests related to the changes.