Skip to content

fix(desktop): restore pre-Pierre changes rows (virtualized) + fix blanked icons - #5807

Merged
Kitenite merged 4 commits into
mainfrom
revert-pierre-diffs-styli
Jul 20, 2026
Merged

Kitenite merged 4 commits into
mainfrom
revert-pierre-diffs-styli

Conversation

@Kitenite

@Kitenite Kitenite commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

What

Restores the pre-#5782 Changes tab rendering (old FolderHeader + FileRow grouped look) and re-adds virtualization, plus two Pierre bug fixes.

  • Folder mode → old FolderHeader + FileRow grouped list (two-tone colored +N −N, StatusIndicator badges, / folder paths, plain filenames, no dot) — now windowed with @tanstack/react-virtual (each section virtualizes into the shared [data-changes-scroll-container] via scrollMargin, matching v1's FileListGroupedVirtualized).
  • Tree mode → the standalone Pierre tree it was before fix(desktop): reuse Pierre for large changes lists #5782 (already virtualized).

Why revert Pierre for this view

Pierre exposes only a single text-only row-decoration slot plus a hardcoded git lane, so it structurally can't render two-tone diff stats and our status icons per row — the unified-Pierre view read as a degraded nested tree. Reverting the rendering and re-virtualizing the old rows gets the intended look and keeps the perf win.

Fix 1 — blanked icons in the Pierre trees

.test.ts and ~300 other file types rendered iconless (Files tab + tree mode):

  • 14 manifest-referenced Material icons ship no asset. Fetching one returns the SPA index.html (HTTP 200, not SVG); the old code only checked response.ok, so that HTML got embedded in a <symbol> and Pierre's div.innerHTML sprite parse aborted mid-stream — only 238 of 547 symbols survived.
  • Fix: fetchSymbolBody rejects non-SVG responses. All 535 symbols parse.

Fix 2 — Pierre trees truncating names that fit

Names like CLAUDE.md middle-truncated to CLAUD…d in the Files-tab explorer. Pierre keeps an empty decoration lane (flex: 1 1 0) whenever the git lane is active but a row has no custom decoration; it grows to fill the row and starves the name column, so the truncation grid clips names that easily fit. Fix: a shared PIERRE_TREE_UNSAFE_CSS lets the name column take the free space and the decoration hug its content. Pierre wraps unsafeCSS in @layer unsafe, overriding @layer base by cascade order — no !important.

Verification (CDP, live dev app)

  • Folder mode matches the target look; tree mode intact; icons render (incl. .test.ts).
  • Virtualization: forced overflow, scrolled — rows window via getVirtualItems, stay correctly positioned across sections (24px stacking + section-header gaps), no scrollMargin drift; measureElement corrects heights.
  • Truncation fix: Files-tab name column went 42px → 271px; full names render, decoration/stats still right-align.
  • tsc --noEmit clean, biome clean, fileIcons tests pass.

Summary by CodeRabbit

  • New Features

    • Added a folder-based view for workspace changes, with collapsible folder sections, file counts, and virtualized scrolling.
    • Enhanced changed-file rows with richer actions (open, view diff, open externally, and discard), including improved selection and navigation behavior.
  • Bug Fixes

    • Prevented non-SVG/HTML responses from corrupting the generated file icon sprite sheet.
    • Improved the Pierre-based file tree layout so name columns retain space when the decoration column is empty.

…e fix

Restores the pre-#5782 changes view: folder mode renders the old
FolderHeader + FileRow grouped list (colored +N/-N, status badges, "/"
paths, plain filenames), tree mode returns to the standalone Pierre tree.
Pierre's single text-only row decoration + hardcoded git lane can't
reproduce two-tone diff stats or our StatusIndicator icons, so the
unified-Pierre folder view read as a degraded nested tree.

Keeps the independent icon-sprite fix: fetchSymbolBody now rejects
non-SVG responses. Missing icon assets resolve to the SPA index.html
(HTTP 200), and that HTML, embedded in a <symbol>, aborted Pierre's
innerHTML sprite parse mid-stream and silently dropped ~300 symbols —
blanking .test.ts and many other file icons in the Pierre trees (Files
tab + changes tree). All 535 symbols now parse.

Tradeoff: folder mode is no longer list-virtualized (reverts #5782's
perf change); tree mode keeps Pierre's virtualization.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d3b426c5-3d28-4eb4-b1ba-94d5892b5290

📥 Commits

Reviewing files that changed from the base of the PR and between f766d2d and 34339fc.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsx

📝 Walkthrough

Walkthrough

The PR separates Changes sidebar tree and folder views, adds grouped folders and interactive file rows, simplifies tree path handling, applies Pierre tree styling, updates tree sizing documentation, and rejects HTML fallback responses during SVG icon loading.

Changes

Changes sidebar views

Layer / File(s) Summary
Folder view and file interactions
.../ChangesFoldersView/*, .../FileRow/*
Adds immediate-parent folder grouping, collapsible headers, virtualized rows, file actions, and discard handling.
Direct tree-mode paths
.../ChangesTreeView/*
Uses relative file paths directly for Pierre tree construction, status, selection, navigation, context menus, and sizing.
View-mode wiring and Pierre styling
.../ChangesFileList/*, apps/desktop/src/renderer/lib/pierreTree/*, .../FilesTab/FilesTab.tsx
Selects the tree or folder component from viewMode and injects Pierre’s unsafe CSS styling into tree configurations.

SVG asset validation

Layer / File(s) Summary
SVG response validation
apps/desktop/src/renderer/lib/fileIcons/loadFallthroughIcons.ts
Rejects non-SVG and HTML fallback responses before generating symbol markup.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ChangesFileList
  participant ChangesFoldersView
  participant FolderHeader
  participant FileRow
  participant TRPC
  ChangesFileList->>ChangesFoldersView: render grouped changes
  ChangesFoldersView->>FolderHeader: render folder controls
  FolderHeader->>ChangesFoldersView: toggle folder state
  ChangesFoldersView->>FileRow: render files in open folders
  FileRow->>TRPC: submit discard mutation
Loading

Possibly related PRs

Suggested reviewers: hackice20

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the two main changes: restoring pre-Pierre change rows and fixing blanked icons.
Description check ✅ Passed It covers What/Why and testing with concrete verification details; the checklist section is missing, but the description is mostly complete.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-pierre-diffs-styli

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reverts the Changes tab folder mode from the @pierre/trees-based unified view back to the pre-Pierre FolderHeader + FileRow grouped rendering, while keeping an independent fix for icon-sprite corruption caused by missing icon assets returning SPA HTML instead of SVG.

  • Folder mode is re-implemented with ChangesFoldersView / FolderHeader / FileRow (non-virtualized); buildPierreProjection and its tests are deleted since Pierre is no longer used for this mode.
  • Tree mode stays on @pierre/trees but is simplified now that it no longer needs to handle folder-mode path projection; the MAX_VIEWPORT_ROWS height cap (which forced Pierre's internal virtualizer to engage) is removed alongside the projection code.
  • Icon fix in loadFallthroughIcons.ts validates that fetched assets are real SVG responses before embedding them in the sprite, preventing HTML fallback pages from aborting the sprite parser and blanking hundreds of icons.

Confidence Score: 3/5

The folder-mode revert and icon fix are both clean, but the tree-mode simplification inadvertently removes the height cap that was the mechanism keeping Pierre's own virtualizer active for large file lists.

The PR's stated goal is to keep Pierre's virtualization in tree mode, but removing MAX_VIEWPORT_ROWS and the Math.min cap sets the host height to Pierre's full content height — the deleted code comment explicitly identified this as what disables Pierre's internal virtualizer. For workspaces with many changed files, tree mode will now render every row eagerly instead of only visible rows, which could produce noticeable slowdowns. Everything else in the change — the new folder components, foldSignal epoch logic, SVG guard — is straightforward and correct.

ChangesTreeView.tsx — the treeHeight calculation and the deleted MAX_VIEWPORT_ROWS constant.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/lib/fileIcons/loadFallthroughIcons.ts Adds SVG content-type guard to reject SPA HTML fallback responses, fixing sprite corruption that blanked 238+ icons in Pierre trees
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/ChangesFileList.tsx Routes folder-mode to ChangesFoldersView and tree-mode to ChangesTreeView; removes the data-changes-scroll-container attribute (not referenced in any v2 code)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx New component restoring pre-Pierre folder-grouped view; collapse-set logic and foldSignal epoch tracking look correct
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/ChangesTreeView.tsx Stripped of folder-mode projection logic; tree-mode simplification is clean, but removing the MAX_VIEWPORT_ROWS height cap disables Pierre's internal virtualizer for large changesets
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx New pre-Pierre file row restoring two-tone diff stats, StatusIndicator, discard mutation, and context/dropdown menus; no selected-state highlighting (intentional per pre-Pierre spec)

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CFL["ChangesFileList"] -->|viewMode === 'tree'| CTV["ChangesTreeView\n(@pierre/trees)"]
    CFL -->|viewMode === 'folders'| CFV["ChangesFoldersView\n(non-virtualized)"]

    CFV --> FH["FolderHeader\n(collapse toggle)"]
    CFV --> FR["FileRow\n(diff stats + StatusIndicator\ndiscard + context menu)"]

    CTV --> Pierre["@pierre/trees\nusePierreFileTree"]
    CTV --> UMH["useMeasuredTreeHeight\n(reads Pierre style.height)"]
    UMH -->|contentHeight| TH["treeHeight = contentHeight + cushion\n⚠ no MAX_VIEWPORT_ROWS cap"]

    loadFallthroughIcons["loadFallthroughIcons\nfetchSymbolBody"] -->|SVG guard| Sprite["Icon Sprite\n(symbol injection)"]
    Pierre --> Sprite
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    CFL["ChangesFileList"] -->|viewMode === 'tree'| CTV["ChangesTreeView\n(@pierre/trees)"]
    CFL -->|viewMode === 'folders'| CFV["ChangesFoldersView\n(non-virtualized)"]

    CFV --> FH["FolderHeader\n(collapse toggle)"]
    CFV --> FR["FileRow\n(diff stats + StatusIndicator\ndiscard + context menu)"]

    CTV --> Pierre["@pierre/trees\nusePierreFileTree"]
    CTV --> UMH["useMeasuredTreeHeight\n(reads Pierre style.height)"]
    UMH -->|contentHeight| TH["treeHeight = contentHeight + cushion\n⚠ no MAX_VIEWPORT_ROWS cap"]

    loadFallthroughIcons["loadFallthroughIcons\nfetchSymbolBody"] -->|SVG guard| Sprite["Icon Sprite\n(symbol injection)"]
    Pierre --> Sprite
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/ChangesTreeView.tsx:160-163
**Tree-mode virtualization silently disabled for large changesets**

The deleted comment from this PR was explicit: "A full-content host disables Pierre's internal virtualizer by making every row part of its viewport. Cap the host while retaining Pierre's own complete scroll range." By removing `MAX_VIEWPORT_ROWS` and the `Math.min(…)` cap, `treeHeight` now equals Pierre's full content height. Pierre's virtualizer then sees its entire row list as in-viewport and renders all rows eagerly — defeating virtualization for any changeset larger than ~20 files. The PR description says "Tree mode keeps Pierre's virtualization," but this change contradicts that: the cap was the mechanism that enabled it.

Reviews (1): Last reviewed commit: "fix(desktop): revert changes list to pre..." | Re-trigger Greptile

Comment on lines +160 to 163
const treeHeight =
contentHeight != null
? contentHeight + HEIGHT_CUSHION
: (dirs.length + paths.length) * ROW_BOX + HEIGHT_CUSHION;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Tree-mode virtualization silently disabled for large changesets

The deleted comment from this PR was explicit: "A full-content host disables Pierre's internal virtualizer by making every row part of its viewport. Cap the host while retaining Pierre's own complete scroll range." By removing MAX_VIEWPORT_ROWS and the Math.min(…) cap, treeHeight now equals Pierre's full content height. Pierre's virtualizer then sees its entire row list as in-viewport and renders all rows eagerly — defeating virtualization for any changeset larger than ~20 files. The PR description says "Tree mode keeps Pierre's virtualization," but this change contradicts that: the cap was the mechanism that enabled it.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/ChangesTreeView.tsx
Line: 160-163

Comment:
**Tree-mode virtualization silently disabled for large changesets**

The deleted comment from this PR was explicit: "A full-content host disables Pierre's internal virtualizer by making every row part of its viewport. Cap the host while retaining Pierre's own complete scroll range." By removing `MAX_VIEWPORT_ROWS` and the `Math.min(…)` cap, `treeHeight` now equals Pierre's full content height. Pierre's virtualizer then sees its entire row list as in-viewport and renders all rows eagerly — defeating virtualization for any changeset larger than ~20 files. The PR description says "Tree mode keeps Pierre's virtualization," but this change contradicts that: the cap was the mechanism that enabled it.

How can I resolve this? If you propose a fix, please make it concise.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx (1)

178-227: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Dropdown and context menus duplicate the same 5 actions verbatim.

DropdownMenuContent (Lines 178-227) and ContextMenuContent (Lines 241-309) repeat Open Diff / Open Diff in New Tab / Open File / Open File in New Tab / Open in Editor with identical handlers, icons, and shortcut logic. Any future edit to one risks drifting from the other.

♻️ Suggested direction

Define a single array of action descriptors (icon, label, onSelect, tier) once, then map it into both <DropdownMenuItem>/<DropdownMenuShortcut> and <ContextMenuItem>/<ContextMenuShortcut> via a small render helper that takes the Item/Shortcut components as parameters.

Also applies to: 241-309

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx
around lines 178 - 227, Refactor FileRow’s duplicated menu actions into one
shared action-descriptor array containing each action’s icon, label, handler,
disabled state, and shortcut tier. Add a small renderer that accepts the menu
item and shortcut components, then use it for both DropdownMenuContent and
ContextMenuContent while preserving all existing handlers, icons, labels,
disabled conditions, and shortcut behavior.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx (1)

7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move FileRow under ChangesFoldersView/components/
FileRow is only used here, so it should be colocated with ChangesFoldersView instead of staying in the shared ChangesFileList/components/ folder.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx
at line 7, Move the FileRow component and its implementation file into the
ChangesFoldersView/components directory, then update the import in
ChangesFoldersView to use the new relative location. Remove the old
shared-folder copy and adjust any related internal imports or exports so FileRow
remains available only to ChangesFoldersView.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx:
- Around line 52-71: Propagate selectedFilePath through folder mode so the
active file remains highlighted: in FileRow.tsx, add an isSelected or
selectedPath prop and apply the active-row class when it matches file.path; in
ChangesFoldersView.tsx, accept selectedFilePath and pass the computed selection
state to each FileRow; in ChangesFileList.tsx, pass selectedFilePath into the
ChangesFoldersView branch.
- Around line 148-230: Update the action wrapper containing the “Discard
changes” and “More actions” controls in FileRow to reveal itself when either
control receives keyboard focus, adding a focus-within visibility state
alongside the existing hover and open-menu states. Preserve the current opacity
and pointer-event behavior for mouse hover and open dropdown interactions.

---

Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx:
- Line 7: Move the FileRow component and its implementation file into the
ChangesFoldersView/components directory, then update the import in
ChangesFoldersView to use the new relative location. Remove the old
shared-folder copy and adjust any related internal imports or exports so FileRow
remains available only to ChangesFoldersView.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx:
- Around line 178-227: Refactor FileRow’s duplicated menu actions into one
shared action-descriptor array containing each action’s icon, label, handler,
disabled state, and shortcut tier. Add a small renderer that accepts the menu
item and shortcut components, then use it for both DropdownMenuContent and
ContextMenuContent while preserving all existing handlers, icons, labels,
disabled conditions, and shortcut behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1de5d727-68d8-4997-9e18-a548efa8bf8a

📥 Commits

Reviewing files that changed from the base of the PR and between 832e184 and 2155e5e.

📒 Files selected for processing (13)
  • apps/desktop/src/renderer/lib/fileIcons/loadFallthroughIcons.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/ChangesFileList.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/components/FolderHeader/FolderHeader.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/components/FolderHeader/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/ChangesTreeView.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/hooks/useMeasuredTreeHeight/useMeasuredTreeHeight.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/utils/buildPierreProjection/buildPierreProjection.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/utils/buildPierreProjection/buildPierreProjection.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/utils/buildPierreProjection/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/index.ts
💤 Files with no reviewable changes (3)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/utils/buildPierreProjection/buildPierreProjection.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/utils/buildPierreProjection/buildPierreProjection.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/utils/buildPierreProjection/index.ts

Comment on lines +52 to +71
interface FileRowProps {
file: ChangesetFile;
workspaceId: string;
worktreePath?: string;
/** Hide the directory prefix — used when the row sits under a folder group. */
hideDir?: boolean;
onSelect?: (path: string, openInNewTab?: boolean, changeKey?: string) => void;
onOpenFile?: (absolutePath: string, openInNewTab?: boolean) => void;
onOpenInEditor?: (path: string) => void;
}

export const FileRow = memo(function FileRow({
file,
workspaceId,
worktreePath,
hideDir,
onSelect,
onOpenFile,
onOpenInEditor,
}: FileRowProps) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Folder mode lost the "currently open file" highlight that tree mode has.

ChangesFileList passes selectedFilePath into ChangesTreeView so Pierre can focus the active row, but the folder-mode path never carries this value down to FileRow — FileRow has no prop/state to render a selected style at all. Users switching to folder view lose the visual cue for which file's diff is currently open.

  • apps/desktop/.../ChangesFileList/components/FileRow/FileRow.tsx#L52-L71: add an isSelected/selectedPath prop and apply an active-row class (e.g. bg-accent) when it matches file.path.
  • apps/desktop/.../ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx#L13-L54: accept selectedFilePath in ChangesFoldersViewProps and pass the computed isSelected down to each FileRow.
  • apps/desktop/.../ChangesFileList/ChangesFileList.tsx#L106-L128: pass selectedFilePath={selectedFilePath} into the <ChangesFoldersView> branch alongside the existing props.
📍 Affects 3 files
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx#L52-L71 (this comment)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesFoldersView/ChangesFoldersView.tsx#L13-L54
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/ChangesFileList.tsx#L106-L128
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx
around lines 52 - 71, Propagate selectedFilePath through folder mode so the
active file remains highlighted: in FileRow.tsx, add an isSelected or
selectedPath prop and apply the active-row class when it matches file.path; in
ChangesFoldersView.tsx, accept selectedFilePath and pass the computed selection
state to each FileRow; in ChangesFileList.tsx, pass selectedFilePath into the
ChangesFoldersView branch.

Comment on lines +148 to +230
<div className="pointer-events-none absolute inset-y-0 right-2 flex items-center gap-0.5 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100">
{canDiscard && (
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
aria-label="Discard changes"
className="flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-destructive"
onClick={(e) => {
e.stopPropagation();
setShowDiscardConfirm(true);
}}
>
<Undo2 className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="top">Discard changes</TooltipContent>
</Tooltip>
)}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
type="button"
aria-label="More actions"
className="flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground"
onClick={(e) => e.stopPropagation()}
>
<ChevronDown className="size-3.5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-64">
<DropdownMenuItem
onSelect={() => onSelect?.(file.path, false, changeKey)}
>
<GitCompare />
Open Diff
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => onSelect?.(file.path, true, changeKey)}
>
<SquarePlus />
Open Diff in New Tab
{diffNewTabTier && (
<DropdownMenuShortcut>
{modifierLabel(diffNewTabTier)}
</DropdownMenuShortcut>
)}
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => absolutePath && onOpenFile?.(absolutePath)}
disabled={!onOpenFile || !absolutePath}
>
<FileText />
Open File
{fileTier && (
<DropdownMenuShortcut>
{modifierLabel(fileTier)}
</DropdownMenuShortcut>
)}
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => absolutePath && onOpenFile?.(absolutePath, true)}
disabled={!onOpenFile || !absolutePath}
>
<SquarePlus />
Open File in New Tab
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => onOpenInEditor?.(file.path)}
disabled={!onOpenInEditor}
>
<ExternalLink />
Open in Editor
{externalTier && (
<DropdownMenuShortcut>
{modifierLabel(externalTier)}
</DropdownMenuShortcut>
)}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Hover-only action buttons have no keyboard focus-visible state.

The actions wrapper is opacity-0 and only reveals via group-hover:opacity-100 / has-[[data-state=open]]:opacity-100. A keyboard user tabbing to the "Discard changes" or "More actions" button will focus an invisible control — no focus-within:opacity-100 (or similar) exists to reveal it.

♿ Proposed fix
-			<div className="pointer-events-none absolute inset-y-0 right-2 flex items-center gap-0.5 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100">
+			<div className="pointer-events-none absolute inset-y-0 right-2 flex items-center gap-0.5 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="pointer-events-none absolute inset-y-0 right-2 flex items-center gap-0.5 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100">
{canDiscard && (
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
aria-label="Discard changes"
className="flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-destructive"
onClick={(e) => {
e.stopPropagation();
setShowDiscardConfirm(true);
}}
>
<Undo2 className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="top">Discard changes</TooltipContent>
</Tooltip>
)}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
type="button"
aria-label="More actions"
className="flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground"
onClick={(e) => e.stopPropagation()}
>
<ChevronDown className="size-3.5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-64">
<DropdownMenuItem
onSelect={() => onSelect?.(file.path, false, changeKey)}
>
<GitCompare />
Open Diff
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => onSelect?.(file.path, true, changeKey)}
>
<SquarePlus />
Open Diff in New Tab
{diffNewTabTier && (
<DropdownMenuShortcut>
{modifierLabel(diffNewTabTier)}
</DropdownMenuShortcut>
)}
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => absolutePath && onOpenFile?.(absolutePath)}
disabled={!onOpenFile || !absolutePath}
>
<FileText />
Open File
{fileTier && (
<DropdownMenuShortcut>
{modifierLabel(fileTier)}
</DropdownMenuShortcut>
)}
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => absolutePath && onOpenFile?.(absolutePath, true)}
disabled={!onOpenFile || !absolutePath}
>
<SquarePlus />
Open File in New Tab
</DropdownMenuItem>
<DropdownMenuItem
onSelect={() => onOpenInEditor?.(file.path)}
disabled={!onOpenInEditor}
>
<ExternalLink />
Open in Editor
{externalTier && (
<DropdownMenuShortcut>
{modifierLabel(externalTier)}
</DropdownMenuShortcut>
)}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
<div className="pointer-events-none absolute inset-y-0 right-2 flex items-center gap-0.5 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100">
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx
around lines 148 - 230, Update the action wrapper containing the “Discard
changes” and “More actions” controls in FileRow to reveal itself when either
control receives keyboard focus, adding a focus-within visibility state
alongside the existing hover and open-menu states. Preserve the current opacity
and pointer-event behavior for mouse hover and open dropdown interactions.

Window the folder-mode changes list with @tanstack/react-virtual so large
changesets stay responsive, while keeping the restored FolderHeader +
FileRow look (colored stats, StatusIndicator, "/" paths). Folder-header
and file rows are flattened into one list; each section virtualizes into
the shared [data-changes-scroll-container] via scrollMargin, matching
v1's FileListGroupedVirtualized. Tree mode already virtualizes via Pierre.

Removes the "folder mode no longer virtualized" tradeoff from the revert.
@Kitenite Kitenite changed the title fix(desktop): revert changes list to pre-Pierre rows, keep icon-sprite fix fix(desktop): restore pre-Pierre changes rows (virtualized) + fix blanked icons Jul 20, 2026
Kitenite added 2 commits July 20, 2026 12:37
Pierre keeps an empty decoration lane (flex: 1 1 0) on every row when the
git lane is active but the row has no custom decoration — every file in
the Files-tab explorer, plus changes with no +/- summary. That empty lane
grows to fill the row and starves the name column, so Pierre's truncation
grid middle-truncates names that easily fit (CLAUDE.md -> CLAUD…d).

Add a shared PIERRE_TREE_UNSAFE_CSS that lets the name column take the free
space and the decoration hug its own content. Pierre wraps unsafeCSS in
@layer unsafe, so it overrides @layer base by cascade order — no !important.
@Kitenite
Kitenite merged commit 0caeb57 into main Jul 20, 2026
10 of 11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

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