Skip to content

feat(trees): add flattened segment truncation option - #1068

Open
AbarnaaSree wants to merge 2 commits into
pierrecomputer:mainfrom
AbarnaaSree:feat/flattened-segments-truncation
Open

feat(trees): add flattened segment truncation option#1068
AbarnaaSree wants to merge 2 commits into
pierrecomputer:mainfrom
AbarnaaSree:feat/flattened-segments-truncation

Conversation

@AbarnaaSree

Copy link
Copy Markdown

Summary

Adds a flattenedSegmentsTruncation option to the FileTree component to control how flattened path segments are truncated.

Changes

  • Added flattenedSegmentsTruncation to the public FileTree options.
  • Added support for per-segment and end truncation modes.
  • Passed the option through FileTree to FileTreeView.
  • Updated row rendering to use the configured truncation behavior.

Validation

  • trees:typecheck — passed
  • 327 tests passed, 0 failed
  • git diff --cached --check — passed
  • Pre-commit checks — passed

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@AbarnaaSree is attempting to deploy a commit to the Pierre Computer Company Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – pierrejs-diff-demo August 9, 2026 09:23 Inactive
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Skipped Skipped Aug 9, 2026 5:53pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e49dae4f2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +90 to +93
return flattenedSegmentsTruncation === 'end' ? (
<MiddleTruncate minimumLength={5}>
{segments.map((segment) => segment.name).join(' / ')}
</MiddleTruncate>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Render the rename input in end truncation mode

When renaming is enabled and a flattened row is renamed with flattenedSegmentsTruncation: 'end', this branch renders only the joined segment names and drops the renameInput that was passed in. Starting rename on such a flattened row leaves renameInputRef unset, so the inline editor never appears/focuses and the user cannot edit or commit the rename in this mode.

Useful? React with 👍 / 👎.

Comment thread packages/trees/src/render/FileTree.ts Outdated
searchFakeFocus,
stickyFolders,
unsafeCSS,
flattenedSegmentsTruncation,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Forward the truncation option through SSR preload

Adding this as a public FileTreeOptions value means callers can pass it to preloadFileTree, but only the client FileTree constructor destructures and forwards it; in preloadFileTree the new field still falls through into controllerOptions and is never passed to FileTreeView. With preloadFileTree({ flattenedSegmentsTruncation: 'end', ... }), the SSR HTML is rendered with the default per-segment markup and then changes on hydrate/render, so the option is ineffective for the server output and produces a client/server first-paint mismatch.

Useful? React with 👍 / 👎.

@vercel
vercel Bot temporarily deployed to Preview – pierrejs-diff-demo August 9, 2026 17:53 Inactive
@AbarnaaSree

Copy link
Copy Markdown
Author

The Vercel checks for pierre-docs-diffs, pierre-docs-diffshub, and pierre-docs-trees require authorization from the Pierre Computer Company Vercel team. The available security checks are passing, and the diff demo deployment is skipped because it is not affected.

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