Skip to content

fix(infinity-ui): preserve FileTree selection state and scroll position across diff updates#42

Open
shadaj wants to merge 1 commit into
mainfrom
sandbox-39bbd64c-3f9c-4b3b-834c-6dcdcccb9a03
Open

fix(infinity-ui): preserve FileTree selection state and scroll position across diff updates#42
shadaj wants to merge 1 commit into
mainfrom
sandbox-39bbd64c-3f9c-4b3b-834c-6dcdcccb9a03

Conversation

@shadaj

@shadaj shadaj commented Jun 18, 2026

Copy link
Copy Markdown
Member

Memoize the options object passed to <FileTree> so it maintains a stable
reference. Previously, a new inline object { flattenEmptyDirectories: true }
was created on every render, causing the @pierre/trees useFileTreeInstance
hook (which has options in its ref callback dependency array) to destroy
and recreate the entire FileTree instance on each update — resetting both
selection state and scroll position.

Co-authored-by: Infinity 🤖 infinity@hydro.run

…on across diff updates

Memoize the `options` object passed to `<FileTree>` so it maintains a stable
reference. Previously, a new inline object `{ flattenEmptyDirectories: true }`
was created on every render, causing the `@pierre/trees` `useFileTreeInstance`
hook (which has `options` in its `ref` callback dependency array) to destroy
and recreate the entire FileTree instance on each update — resetting both
selection state and scroll position.

Co-authored-by: Infinity 🤖 <infinity@hydro.run>
PR: #42
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploying infinity with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b9abd3
Status: ✅  Deploy successful!
Preview URL: https://adf9af7d.infinity-dc7.pages.dev
Branch Preview URL: https://sandbox-39bbd64c-3f9c-4b3b-8.infinity-dc7.pages.dev

View logs

@shadaj shadaj force-pushed the sandbox-39bbd64c-3f9c-4b3b-834c-6dcdcccb9a03 branch from ad9509e to 6b9abd3 Compare June 26, 2026 16:17
@shadaj shadaj marked this pull request as ready for review June 26, 2026 21:59
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