Skip to content

Commit ed0d56c

Browse files
adamleithpclauderaquelmsmith
authored
feat(channels): new channel sidebar item — collapsible, New… picker, shared menus (#2824)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
1 parent d9b5c81 commit ed0d56c

10 files changed

Lines changed: 703 additions & 322 deletions

File tree

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@posthog/git": "workspace:*",
6161
"@posthog/host-router": "workspace:*",
6262
"@posthog/platform": "workspace:*",
63-
"@posthog/quill-charts": "0.3.0-beta.18",
63+
"@posthog/quill-charts": "0.3.0-beta.19",
6464
"@posthog/shared": "workspace:*",
6565
"@posthog/workspace-client": "workspace:*",
6666
"@radix-ui/react-collapsible": "^1.1.12",

packages/ui/src/features/canvas/AGENTS.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@ is an agent-authored single-file React app rendered in a sandboxed iframe. Read
55
this before changing breadcrumbs, canvas naming, or the canvas generation harness.
66
The root `AGENTS.md` architecture rules still apply.
77

8+
## Components & styling
9+
10+
- **Use `@posthog/quill`, not Radix.** New UI in this space pulls components from
11+
`@posthog/quill` (`Button`, `Dialog*`, `AlertDialog*`, `DropdownMenu*`,
12+
`ContextMenu*`, `Tooltip*`, `Collapsible*`, …). Do **not** reach for
13+
`@radix-ui/themes` or `@radix-ui/react-*`. Some older code here still imports
14+
`@radix-ui/themes` (`Box`, `Flex`, `Text`, `AlertDialog`) — that's legacy to be
15+
migrated, not a pattern to copy. When you touch such code, prefer swapping to
16+
the Quill equivalent.
17+
- **Don't restyle Quill internals.** Quill components are already themed —
18+
spacing, typography, and especially **color** are baked in. Do not add
19+
`text-gray-*` / `text-muted-foreground` / `font-*` or other color/typography
20+
classes to elements *inside* a Quill component (menu items, dialog titles,
21+
buttons, etc.); you'll fight or override the design system and drift from every
22+
other surface. Trust the defaults. Layout-only utilities (`flex`, `gap`,
23+
width/`max-w`, `truncate`) on wrappers are fine; reach for `className` overrides
24+
on Quill items only when there is a real, deliberate exception — and call it out.
25+
- **Suffix `` on anything that opens another step.** A menu item or button whose
26+
click opens a follow-up surface — a dialog, a nested menu, a picker, a
27+
confirmation — gets a trailing ellipsis (``, the character, not three dots) to
28+
signal it isn't the final action: `New…`, `Rename channel…`, `Delete channel…`,
29+
`Choose a template…`. A label that performs its action immediately or navigates
30+
straight to a destination gets **no** ellipsis (`Edit CONTEXT.md`, `Star
31+
channel`). When in doubt: does clicking it ask for more input or confirmation
32+
before anything happens? If yes, add the ``.
33+
834
## Spaces & chrome
935

1036
- Channels is a **top-level space** reached through the app rail (`AppNav`),
@@ -53,3 +79,25 @@ The root `AGENTS.md` architecture rules still apply.
5379
Freeform autosaves the whole file each agent turn, so a concurrent edit from
5480
another client can clobber. Acceptable for now; revisit with optimistic
5581
concurrency if multi-client editing becomes real.
82+
83+
## Channel sidebar preloading
84+
85+
- A channel's contents load **lazily on expand**: `ChannelSection`
86+
(`components/ChannelsList.tsx`) only passes a real `channelId` to its content
87+
queries once `open` is true, so the tree doesn't fire one query per channel on
88+
mount.
89+
- To keep first-open instant, the same caches are **warmed on hover/focus**:
90+
`ChannelSection.prefetchContents()` runs from the row's `onMouseEnter` /
91+
`onFocus` and prefetches every per-channel query. Each prefetch hook reuses the
92+
query's `queryOptions` with the **same `staleTime`** as the live query, so it
93+
no-ops when the data is already fresh.
94+
- **Rule: lazy-loaded content and preloading must stay in lockstep.** When you
95+
add a new per-channel item type to the expanded tree (a new query gated on
96+
`open`, like dashboards or filed tasks), you MUST also:
97+
1. add a `usePrefetch…` hook next to that query (mirror `usePrefetchDashboards`
98+
in `hooks/useDashboards.ts` / `usePrefetchChannelTasks` in
99+
`hooks/useChannelTasks.ts` — same key, same `staleTime`), and
100+
2. call it inside `ChannelSection.prefetchContents()`.
101+
102+
Otherwise the new content cold-fetches on first expand and reintroduces the
103+
open jank the prefetch path exists to prevent.

0 commit comments

Comments
 (0)