Skip to content

Commit be4b655

Browse files
adamleithpclaude
andcommitted
fix(channels): don't flash the empty state while a new channel resolves
WebsiteChannelHome took only `channel` from useBackendChannel and dropped its isLoading. For a freshly created channel that hook resolves the backend channel over the network (a resolve-or-create POST), and for that whole window the view had no intro (it needs backendChannel), no tasks, and — because the feed query is disabled until the id exists, and a disabled query reports isLoading:false — believed it wasn't loading. So ChannelFeedView fell through to `emptyState` and flashed the welcome + suggestions screen before the feed appeared. Fold the identity resolution into the loading flag: a channel isn't empty until we know which channel it is. A plain reload never showed this because the backend channels list is already cached by the time the view mounts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019G63f4afY9vsbKsvK654Wj
1 parent 1e93534 commit be4b655

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

packages/ui/src/features/canvas/components/WebsiteChannelHome.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5252
export function WebsiteChannelHome({ channelId }: { channelId: string }) {
5353
const navigate = useNavigate();
5454
const queryClient = useQueryClient();
55-
const { channels } = useChannels();
55+
const { channels, isLoading: isLoadingChannels } = useChannels();
5656
const channelName = channels.find((c) => c.id === channelId)?.name;
5757
const { fileTask } = useChannelTaskMutations();
5858

@@ -64,8 +64,23 @@ export function WebsiteChannelHome({ channelId }: { channelId: string }) {
6464

6565
// The folder channel maps onto a backend channel (by name; "me" → the
6666
// personal channel), which owns the task feed and threads.
67-
const { channel: backendChannel } = useBackendChannel(channelName);
68-
const { tasks, isLoading } = useChannelFeed(backendChannel?.id);
67+
const { channel: backendChannel, isLoading: isResolvingChannel } =
68+
useBackendChannel(channelName);
69+
const { tasks, isLoading: isLoadingFeed } = useChannelFeed(
70+
backendChannel?.id,
71+
);
72+
// Until the backend channel resolves there's no feed to ask for, and the feed
73+
// query is disabled — which reports isLoading:false, indistinguishable from
74+
// "this channel is empty". A freshly created channel resolves its backend
75+
// channel over the network (a POST), so treating that window as "not loading"
76+
// flashes the welcome/suggestions empty state before the feed appears. Fold
77+
// the whole identity resolution in: we can't call a channel empty until we
78+
// know which channel it is.
79+
const isLoading =
80+
isLoadingChannels ||
81+
isResolvingChannel ||
82+
(!!channelName && !backendChannel) ||
83+
isLoadingFeed;
6984
// Durable "PostHog agent" rows (CONTEXT.md being built, …) live on the
7085
// backend channel — the same id the feed tasks use, not the folder id.
7186
const { messages: feedMessages } = useChannelFeedMessages(backendChannel?.id);

0 commit comments

Comments
 (0)