:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(desktop): keep space tabs visible while its list loads (#87162)
Raquel Smith86e06159fe21
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelItemsPane.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelItemsPane.tsxindex 2cea86bb0be5..a98265526035 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelItemsPane.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelItemsPane.tsx@@ -91,11 +91,6 @@ const SKELETON_ROW_WIDTHS = [60, 80, 40, 75, 50, 66] as const;function ChannelItemsSkeleton() {return (<div aria-hidden className="flex flex-col gap-px">- <SkeletonText- lines={1}- maxWidth={100}- className="mx-2 mt-1.5 mb-1 w-12 text-xs"- />{SKELETON_ROW_WIDTHS.map((width) => (<div key={width} className="flex items-center gap-2 px-2 py-1.5"><Skeleton className="size-4 shrink-0 rounded" />@@ -225,7 +220,6 @@ export function ChannelItemsPane({itemCount: items.length,narrowed,});- const showHeader = listState === "ready" || listState === "empty";const {selectedTaskIds,@@ -338,45 +332,45 @@ export function ChannelItemsPane({className="relative flex min-h-0 flex-1 flex-col"data-testid="channel-items-pane">- {showHeader && (- <div className="flex flex-col gap-1 border-border border-b px-2 py-1.5">- {headerLeft && (- <div className="flex flex-wrap items-center gap-0.5">- {headerLeft}- </div>- )}- <InputGroup className="h-7">- <InputGroupAddon align="inline-start">- <MagnifyingGlass size={12} className="text-muted-foreground" />- </InputGroupAddon>- <InputGroupInput- value={query}- onChange={(event) => setQuery(event.target.value)}- placeholder="Search…"- aria-label={searchLabel}- className="text-[12px]"+ {/* The header stays through the load: the tabs in `headerLeft` are how you+ choose what the list is fetching, so they can't wait on the fetch. */}+ <div className="flex flex-col gap-1 border-border border-b px-2 py-1.5">+ {headerLeft && (+ <div className="flex flex-wrap items-center gap-0.5">+ {headerLeft}+ </div>+ )}+ <InputGroup className="h-7">+ <InputGroupAddon align="inline-start">+ <MagnifyingGlass size={12} className="text-muted-foreground" />+ </InputGroupAddon>+ <InputGroupInput+ value={query}+ onChange={(event) => setQuery(event.target.value)}+ placeholder="Search…"+ aria-label={searchLabel}+ className="text-[12px]"+ />+ <InputGroupAddon align="inline-end">+ <ChannelFilterMenu+ filters={filters}+ onFilterChange={(key, value) =>+ setFilters({ ...rawFilters, [key]: value })+ }+ onClearFilters={() => setFilters(DEFAULT_CHANNEL_ITEM_FILTERS)}+ sort={sort}+ onSortChange={setSort}+ grouping={grouping}+ onGroupingChange={changeGrouping}+ onEditAppearance={() => setAppearanceOpen(true)}+ sources={sources}+ showCreatedBy={hasMultipleAuthors}+ showRunFilters={hasRuns}+ active={filtersActive}/>- <InputGroupAddon align="inline-end">- <ChannelFilterMenu- filters={filters}- onFilterChange={(key, value) =>- setFilters({ ...rawFilters, [key]: value })- }- onClearFilters={() => setFilters(DEFAULT_CHANNEL_ITEM_FILTERS)}- sort={sort}- onSortChange={setSort}- grouping={grouping}- onGroupingChange={changeGrouping}- onEditAppearance={() => setAppearanceOpen(true)}- sources={sources}- showCreatedBy={hasMultipleAuthors}- showRunFilters={hasRuns}- active={filtersActive}- />- </InputGroupAddon>- </InputGroup>- </div>- )}+ </InputGroupAddon>+ </InputGroup>+ </div>{/* biome-ignore lint/a11y/noStaticElementInteractions: drag-and-drop container */}<divdiff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.test.tsxindex bfd088616db7..1033214f327b 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.test.tsx@@ -146,8 +146,8 @@ describe("ChannelSidebar", () => {{what: "nothing has arrived yet",state: { items: [], isLoading: true },- shown: [] as string[],- hidden: ["Sessions", "No matches", "No sessions yet"],+ shown: ["Sessions"],+ hidden: ["No matches", "No sessions yet"],},{what: "the space is settled and genuinely empty",diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsxindex ae02584130f8..6449e78b0da4 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx@@ -333,6 +333,17 @@ describe("ChannelsSidebar", () => {expect(screen.getByTestId("channel-sidebar").textContent).toBe(ME.id);});+ // The pane carries the space's own tabs, so holding it back until the space+ // list lands left a cold load with nothing to switch between.+ it("opens the route's channel before the channel list lands", () => {+ mocks.routeChannelId = ENG.id;+ mocks.channels = [];+ mocks.channelsLoading = true;+ renderSidebar();+ expect(screen.getByTestId("channel-sidebar").textContent).toBe(ENG.id);+ expect(listIsInteractive()).toBe(false);+ });+it("stays on the list while no channel resolves", () => {mocks.channels = [ENG];renderSidebar();diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsxindex 6a62ea82fa9f..a2603abda259 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx@@ -27,6 +27,7 @@ import {showChannelPane,useChannelPaneStore,} from "@posthog/ui/features/canvas/stores/channelPaneStore";+import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";import { useOnboardingStore } from "@posthog/ui/features/onboarding/onboardingStore";import { NavResizeTooltip } from "@posthog/ui/features/sidebar/components/NavResizeTooltip";import { ProjectSwitcher } from "@posthog/ui/features/sidebar/components/ProjectSwitcher";@@ -197,7 +198,12 @@ function ChannelsSidebarImpl() {const archivedTaskIds = useArchivedTaskIds();// Scoping lives in ChannelRouteSync: this column is not always drawn.- const { currentChannelId } = useCurrentChannel({ enabled: channelsLayout });+ useCurrentChannel({ enabled: channelsLayout });+ // The route's space, before the space list has resolved it. That hook withholds+ // an unresolved id so nothing files against a dead space, but the pane only has+ // to draw one — waiting held its tabs behind the fetch, and a stale id is+ // dropped by the same hook a tick later.+ const currentChannelId = useCurrentChannelStore((s) => s.currentChannelId);// Browsing the list is view state, not navigation: you stay in the channel// (route and main pane unchanged) while you look around. With no channel to