Skip to content

fix: update Grid when dir changes - #913

Merged
bvaughn merged 2 commits into
bvaughn:mainfrom
imshunsuke:fix/grid-dynamic-dir
Sep 5, 2026
Merged

bvaughn merged 2 commits into
bvaughn:mainfrom
imshunsuke:fix/grid-dynamic-dir

Conversation

@imshunsuke

Copy link
Copy Markdown
Contributor

When a mounted Grid changed its explicit dir prop between "ltr" and "rtl", useIsRtl kept the value from the initial render. Its layout effect only recalculated direction when no explicit dir was provided.

This updates the hook to synchronize explicit direction changes while preserving DOM and ancestor direction detection when the prop is unset. A regression test covers both ltr → rtl and rtl → ltr.

Tested with the full unit test suite, ESLint, TypeScript, Prettier, and the library and documentation production builds.

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

@imshunsuke is attempting to deploy a commit to the Brian Vaughn's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-window Ready Ready Preview Sep 5, 2026 1:15pm UTC

@bvaughn bvaughn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks! This is a nice improvement.

I guess if we wanted to go further we could use a mutation observer to listen for a change to the element's dir attribute, but maybe that's overkill 🙃

@bvaughn
bvaughn merged commit 4c60ef8 into bvaughn:main Sep 5, 2026
7 checks passed
@bvaughn

bvaughn commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Released in react-window@2.3.1

This branch was successfully deployed

1 active deployment
Preview — 7224be72 Deployed Sep 5, 2026 by vercel[bot]
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.

2 participants