Skip to content

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

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

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>
@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: ad9509e
Status: ✅  Deploy successful!
Preview URL: https://18166331.infinity-dc7.pages.dev
Branch Preview URL: https://sandbox-39bbd64c-3f9c-4b3b-8.infinity-dc7.pages.dev

View logs

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