feat(sidebar): show repository context on pinned tasks - #76471
charlesvien wants to merge 10 commits into
Conversation
Pinned tasks float above the per-repository groups, so they lost the one piece of context the group header would have given them. With a long pinned list there was no way to tell which checkout a task belonged to. Each pinned row now carries a second line reading `repository · branch`. The repository half reuses the registered folder's name so it matches the group header the task would otherwise sit under; the branch half uses the task's linked branch, falling back to a worktree's checked-out branch. Neither half appears when unknown, so a repo-less task stays a single line and a local task sitting on the default branch never renders a repeated "· main". Rows inside a repository group are unchanged — their header already says where they live. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
…Date
The story computed its `timestamp` args at module scope via `Date.now()`, but
the visual-regression runner freezes the clock to a fixed instant in a decorator
that runs at render. The args were therefore measured against a different clock
than they were rendered against, and since the frozen instant is behind real
time every relative label collapsed to "now" in CI — losing the timestamp
variety the story exists to show, and leaving the new snapshots dependent on how
the real and frozen clocks happen to line up.
Fixtures now carry an age in hours and resolve it to a timestamp during render,
so the labels read off the same clock that renders them. Verified the story
renders identically ("now / 3h / 1d / 1d") both under a spoofed
StorybookTestRunner user agent and interactively.
Generated-By: PostHog Code
Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
…shots The story's task titles and branch names were transcribed from a real pinned task list, which does not belong in a public repo and made the fixture read as someone's actual work queue. Replaced with generic equivalents of the same shape, so the row still demonstrates truncation and the varied workspace modes. The PNGs are here only so the pull request description can embed them by commit SHA; the next commit removes them, which leaves the blobs reachable at that SHA without carrying binaries into the merge. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
The pull request description references these by the commit SHA that added them, which keeps the blobs reachable on GitHub after this removal — so the images still render in the description while the merged tree stays free of binaries. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
…context map `TaskContextFolder` re-declared the folder fields that `findGroupFolder` already expressed as an inline generic constraint, so the two could drift apart if the group-matching logic ever needed another field. Names that shape once as `GroupableFolder` (beside the existing `GroupableTask`) and has both the constraint and `TaskContextFolder` build on it. The pinned rows also memoised a taskId-keyed Map of context lines and then read it back inside the same `.map()` that already had the task in hand. The keyed lookup bought nothing, and the memo rarely held anyway — `partitionAndSortTasks` hands back a fresh array on most recomputes, so the dependency changed identity about as often as the value did. Formatting inline drops the memo, the Map, and the `?? undefined` round trip. No behaviour change: same rendered output, same tests. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
4 updated Run: c415305b-3154-4416-a261-b2198e77b9cc Co-authored-by: haacked <19977+haacked@users.noreply.github.com>
Referenced from the description by this commit's SHA, so the next commit can remove them without breaking the images. The "before" shot is the same story with the subtitle prop withheld, which is exactly how the row rendered before this branch: with no subtitle, SidebarItem skips both the second line and the height override. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
The description references them by the commit SHA that added them, so they keep rendering while the merged tree stays free of binaries. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
…omment The subtitle inherited `truncate` but not the tooltip that `SidebarItemLabel` pairs with it, so a clipped `repository · branch` had no way back — the branch tail is what falls off, since the repository leads the string. Giving `SidebarItemLabel` an optional className lets the subtitle reuse that same measure-and-tooltip-only-when-overflowing path instead of a second bare span. Renders byte-identically, so the approved visual baselines still hold. Also corrects the comment on `repositoryLabel`, which claimed the line reads "exactly like the group header". That only holds when a folder is registered: `groupByRepository` prefixes the organization when two group names collide, and this cannot reproduce that from a single task. Borrowing the group's name is not an option either, since groups are built from the unpinned tasks, so a pinned task's repo may have no group at all. The comment now says what the code does and why the gap is deliberate. Generated-By: PostHog Code Task-Id: 7dd3d861-551c-4234-8747-cce924cb7a0b
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Reviews (1): Last reviewed commit: "fix(sidebar): tooltip the truncated cont..." | Re-trigger Greptile |
|
@haacked this is your PostHog/code#3808 remade in the monorepo (main there is frozen after the desktop import). Your commits are intact, only paths moved plus small conflict fixes noted in the description. Can you review and approve if it looks good? |
|
@puemos can you review this one? haacked made it on the code repo (PostHog/code#3808) and I remade it here after the desktop import. Given your recent changes in the sidebar you're the right person to review it. |
overall it looks fine but we are moving away from this layout so this will be gone. In any case I'll review, just in case we decide not to move this week |
| taskId: string; | ||
| label: string; | ||
| /** Second line under the title, e.g. the task's `repository · branch`. */ | ||
| subtitle?: string; |
There was a problem hiding this comment.
🟥 Blocking
When hovering the TaskItem it moves a bit
jumping.mov
| depth?: number; | ||
| taskId: string; | ||
| label: string; | ||
| /** Second line under the title, e.g. the task's `repository · branch`. */ |
There was a problem hiding this comment.
🟦 Nice-to-have:
we can remove this comment
| }) { | ||
| const canTooltip = typeof label === "string" || typeof label === "number"; | ||
|
|
||
| const measureRef = useCallback((el: HTMLSpanElement | null) => { |
There was a problem hiding this comment.
🟦 Nice-to-have
I wonder if this should belong in a reusable hook
Ports PostHog/code#3808 into the monorepo (PostHog/code
mainis frozen after the desktop import; open PRs there are remade here). Commits preserve the original authorship.Problem
Pinned tasks only show a title. They sit above the per-project groups, so unlike every other row they never get a repository from a group header, and once you have a dozen of them pinned there's no way to tell which checkout one belongs to. Supacode's pinned list shows the repo under each task and I wanted the same thing here.
Changes
Before:
After:
· mainrepeated down the whole listButtonpins a fixed height, so the two-line row opts out withh-auto!the same wayCommandMenuandMessageJumpPickeralready doLight theme
How did you test this code?
pnpm typecheckandbiome check, both cleanformatTaskContext: worktree vs local vs cloud, linked branch vs checked-out branch, default-branch suppression, folder naming, and the repo-less fallbackvitest run src/features/sidebarin packages/ui (111 pass) andpnpm --filter @posthog/core test(2507 pass)Sidebar/TaskItemstory, which is where the screenshots above come from. Also eyeballed the active-row and hover-toolbar states in both themesnode scripts/check-host-boundaries.mjs, no new violationsproducts/desktop/,pnpm install --frozen-lockfile,pnpm typecheck(24/24 clean), full@posthog/coresuite (2973), UI sidebar tests (117) and the host-boundary check (no new violations) all passAutomatic notifications
Docs update
N/A
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
This PR is a port of PostHog/code#3808 (author: haacked) into
products/desktop/, done with Claude Code following the repo's /porting-code-prs skill:git am -3 --directory=products/desktop/over the source patch series, preserving the original commits and authorship (including aposthog[bot]storybook-baseline commit; the baseline file is inert here since the monorepo removed the desktop storybook CI). One conflict: the source PR branched before the pinned tree replacedSidebarItemLabelwithOverflowTickerTextfor the row label, so its last commit edited a helper our tree no longer had. Resolved by keeping the monorepo'sOverflowTickerTextlabel and reintroducingSidebarItemLabel(with the quill tooltip imports) solely for the subtitle line, which is what the commit was after.Created with PostHog Code