Skip to content

Provide a hook for post-resize/reflow, when contents are ready to be scrolled #1168

@stewartadam

Description

@stewartadam

It would be ideal to have a hook provided by glide data grid when grid resize/reflow has completed, and scrollTo() can be called safely. Right now, placing a ResizeObserver on the glide data grid container correctly identifies the moment the container size changes, but Glide hasn't completed its internal reflow yet so scrollTo() does nothing.

I came across this issue after placing the glide data grid into a dockview panel and tried to keep scroll position after the user flips to a different panel and then back to the data grid. Dockview applies display:none to non-focused panels, causing the Glide data grid's size to be 0x0.

Glide correctly resizes back to the container size when focus switches back to the panel containing the data grid, however there's no way for us to identify when its safe to call scrollTo(). Attempting to call it before Glide has completed its internal size reflow has no effect. Unfortunately even waiting for gridRef.current.getBounds() to return a non-zero size also doesn't work - the rows aren't populated by then. It takes another 2-3 animation frames before scrollTo works, and that results in a brief flicker.

See also: mathuo/dockview#1063

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions