Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(favorites): show channel profile pictures (#9143)
gbirmanb518ba8db3a3
diff --git a/apps/web/src/features/favorites/FavoriteIcon.tsx b/apps/web/src/features/favorites/FavoriteIcon.tsxindex 0dc0bd7f4b..f1b1e90038 100644--- a/apps/web/src/features/favorites/FavoriteIcon.tsx+++ b/apps/web/src/features/favorites/FavoriteIcon.tsx@@ -2,6 +2,7 @@ import {favoriteIconType,useFavoriteDmRecipientId,} from '@app/util/favorites';+import { ChannelAvatar } from '@channel/channel-avatar';import { EntityIcon } from '@core/component/EntityIcon';import { UserIcon, type UserIconSize } from '@core/component/UserIcon';import type { Favorite } from '@service-storage/generated/schemas/favorite';@@ -9,8 +10,8 @@ import { Show } from 'solid-js';/*** Icon for a favorite. DM channel favorites show the other participant's- * avatar, matching how channel rows render elsewhere in the sidebar;- * everything else shows its entity icon.+ * avatar, and other channels show their channel picture, matching channel+ * rows elsewhere in the sidebar. Other favorites keep their entity icon.** The favorite's identity must be stable for the component's lifetime* (favorites lists key rows by entity, so it is).@@ -25,11 +26,31 @@ export function FavoriteIcon(props: {<Showwhen={dmRecipientId()}fallback={- <EntityIcon- size="xs"- targetType={favoriteIconType(props.favorite)}- class={props.class}- />+ <Show+ when={+ props.favorite.entityType === 'channel' &&+ props.favorite.channelType !== 'direct_message'+ }+ fallback={+ <EntityIcon+ size="xs"+ targetType={favoriteIconType(props.favorite)}+ class={props.class}+ />+ }+ >+ <ChannelAvatar+ channelId={props.favorite.entityId}+ class={`size-4 ${props.class ?? ''}`}+ fallback={+ <EntityIcon+ size="xs"+ targetType={favoriteIconType(props.favorite)}+ class={props.class}+ />+ }+ />+ </Show>}>{(recipientId) => (diff --git a/apps/web/src/lib/queries/channel/picture.ts b/apps/web/src/lib/queries/channel/picture.tsindex 1cd895b0ac..7d40f9f048 100644--- a/apps/web/src/lib/queries/channel/picture.ts+++ b/apps/web/src/lib/queries/channel/picture.ts@@ -55,7 +55,7 @@ export function useChannelPicture(channelId: Accessor<string>) {const query = useQuery(() => channelPictureQueryOptions(channelId()));// The icon keeps its fallback while loading; it must never suspend its row.- const pictureId = () => (query.isSuccess ? query.data : null);+ const pictureId = () => (query.isPending ? null : query.data);return {url: () => {const id = pictureId();diff --git a/apps/web/src/lib/queries/channel/tests/picture.test.tsx b/apps/web/src/lib/queries/channel/tests/picture.test.tsxindex 7a93e4e146..48dddf657f 100644--- a/apps/web/src/lib/queries/channel/tests/picture.test.tsx+++ b/apps/web/src/lib/queries/channel/tests/picture.test.tsx@@ -219,6 +219,32 @@ it('preserves the existing picture if upload confirmation fails', async () => {);});+it('keeps a cached picture visible when its background refresh fails', async () => {+ const queryKey = channelKeys.picture('channel').queryKey;+ client.setQueryDefaults(queryKey, { retry: false });+ client.setQueryData(queryKey, 'cached-picture');+ vi.mocked(previewDataLoader.load).mockRejectedValue(new Error('Unavailable'));+ dispose = render(+ () => (+ <QueryClientProvider client={client}>+ <ChannelAvatar+ channelId="channel"+ fallback={<span data-testid="picture-fallback" />}+ />+ </QueryClientProvider>+ ),+ document.body+ );+ const image = document.querySelector('img');+ expect(image?.getAttribute('src')).toBe('/file/cached-picture');++ await client.refetchQueries({ queryKey });++ expect(client.getQueryState(queryKey)?.status).toBe('error');+ expect(client.getQueryData(queryKey)).toBe('cached-picture');+ expect(document.querySelector('img')).toBe(image);+});+it('tracks cached picture ids so a menu built before one loads recomputes', () => {createRoot((dispose) => {const cachedPictureId = createCachedChannelPicture();diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.mdindex 55843736a4..23d82a6592 100644--- a/docs/agent-guide/navigation.md+++ b/docs/agent-guide/navigation.md@@ -810,6 +810,13 @@ databases, and forms support toggling; database and form favorites appear in Drisidebar. Individual channel messages and pull requests are not favoritable. Afavorited agent session disappears from the list once the session is deleted.+Channel favorites show the same channel picture as regular channel rows, with+the channel icon as a fallback when no picture is available. Direct-message+favorites use the participant's avatar when available and the entity icon+otherwise. Cached pictures remain visible when a background picture query+rejects with an error; an omitted or unavailable channel preview uses the+fallback icon.+With the GraphQL local cache enabled, cached favorites remain visible when offlineor when a background refresh fails. Toggle and reorder success while offline meansthe change was accepted into the durable queue, not yet confirmed by the server.