Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

Debug Suspense boundaries and gate Quick Access snippets (#7023)

teo8b92ba3b631d
diff --git a/apps/web/src/features/channel/Channel/ChannelDetail.tsx b/apps/web/src/features/channel/Channel/ChannelDetail.tsx
index 75924160de..8efb1c44c8 100644
--- a/apps/web/src/features/channel/Channel/ChannelDetail.tsx
+++ b/apps/web/src/features/channel/Channel/ChannelDetail.tsx
@@ -12,6 +12,7 @@ import { useCall } from '@channel/Call/use-call';
import { ChannelCallsTab } from '@channel/Calls/ChannelCallsTab';
import { ChannelInviteButton } from '@channel/channel-invite-button';
import { ChannelTopIcon } from '@channel/components/ChannelTopIcon';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { ChannelParticipantsTab } from '@channel/Participants/ChannelParticipantsTab';
import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';
import {
@@ -38,7 +39,6 @@ import {
on,
onCleanup,
Show,
- Suspense,
Switch,
} from 'solid-js';
import {
@@ -160,20 +160,26 @@ export function ChannelDetailActions(props: ChannelDetailHeaderProps) {
return (
<div class="header-actions ml-auto flex shrink-0 items-center gap-2">
- <ChannelLiveIndicators channelId={props.channelId} />
- <Suspense>
+ <DebugSuspense name="ChannelDetail.live-indicators">
+ <ChannelLiveIndicators channelId={props.channelId} />
+ </DebugSuspense>
+ <DebugSuspense name="ChannelDetail.invite">
<ChannelInviteButton
channelId={props.channelId}
channelName={channelName() ?? 'New Channel'}
channelType={channelType()}
/>
- </Suspense>
+ </DebugSuspense>
<Show when={ENABLE_CALLS && !call.isInThisChannel()}>
- <ChannelCallButton channelId={props.channelId} />
+ <DebugSuspense name="ChannelDetail.call-button">
+ <ChannelCallButton channelId={props.channelId} />
+ </DebugSuspense>
</Show>
<Show when={askMacroEntity()}>
{(entity) => (
- <ChatWithAgentButton entity={entity()} label="Ask Macro" />
+ <DebugSuspense name="ChannelDetail.ask-macro">
+ <ChatWithAgentButton entity={entity()} label="Ask Macro" />
+ </DebugSuspense>
)}
</Show>
</div>
@@ -200,26 +206,32 @@ export function ChannelDetailTopBar(
class="relative h-full min-w-0 shrink overflow-hidden"
contentClass="flex h-full items-center gap-3"
>
- <Show
- when={props.leading}
- fallback={
- <ChannelDetailTitle
- channelId={props.channelId}
- fallbackName={props.fallbackName}
- />
- }
- >
- {props.leading}
- </Show>
- <ChannelDetailTabs
+ <DebugSuspense name="ChannelDetail.title">
+ <Show
+ when={props.leading}
+ fallback={
+ <ChannelDetailTitle
+ channelId={props.channelId}
+ fallbackName={props.fallbackName}
+ />
+ }
+ >
+ {props.leading}
+ </Show>
+ </DebugSuspense>
+ <DebugSuspense name="ChannelDetail.tab-strip">
+ <ChannelDetailTabs
+ channelId={props.channelId}
+ collapser={collapse.collapser}
+ />
+ </DebugSuspense>
+ </PriorityCollapseOverflowSensor>
+ <DebugSuspense name="ChannelDetail.actions">
+ <ChannelDetailActions
channelId={props.channelId}
- collapser={collapse.collapser}
+ fallbackName={props.fallbackName}
/>
- </PriorityCollapseOverflowSensor>
- <ChannelDetailActions
- channelId={props.channelId}
- fallbackName={props.fallbackName}
- />
+ </DebugSuspense>
</ViewShell.TopBar>
);
}
@@ -334,46 +346,62 @@ function ChannelDetailContent(props: ChannelDetailProps) {
return (
<ChannelSurface channelId={channelId} targetRequest={targetRequest()}>
- <CallEventSync />
+ <DebugSuspense name="ChannelDetail.call-event-sync">
+ <CallEventSync />
+ </DebugSuspense>
<ChannelTabProvider activeTab={activeTab} setActiveTab={setActiveTab}>
- <ChannelCallAutoJoin
- channelId={channelId}
- pendingJoinCall={pendingJoinCall}
- onHandled={() => setPendingJoinCall(false)}
- />
- <div class="flex size-full min-h-0 flex-col">
- <ChannelDetailHeader
- render={props.children}
- context={{
- channelId,
- name: () => channelName() ?? 'New Channel',
- }}
+ <DebugSuspense name="ChannelDetail.auto-join">
+ <ChannelCallAutoJoin
+ channelId={channelId}
+ pendingJoinCall={pendingJoinCall}
+ onHandled={() => setPendingJoinCall(false)}
/>
+ </DebugSuspense>
+ <div class="flex size-full min-h-0 flex-col">
+ <DebugSuspense name="ChannelDetail.header">
+ <ChannelDetailHeader
+ render={props.children}
+ context={{
+ channelId,
+ name: () => channelName() ?? 'New Channel',
+ }}
+ />
+ </DebugSuspense>
<div class="flex min-h-0 flex-1 flex-col px-2">
<Switch>
<Match when={activeTab() === 'messages'}>
- <ChannelMessages autofocus={props.autofocus ?? false} />
+ <DebugSuspense name="ChannelDetail.messages">
+ <ChannelMessages autofocus={props.autofocus ?? false} />
+ </DebugSuspense>
</Match>
<Match when={activeTab() === 'attachments'}>
- <ChannelAttachmentsTab channelId={channelId} />
+ <DebugSuspense name="ChannelDetail.attachments">
+ <ChannelAttachmentsTab channelId={channelId} />
+ </DebugSuspense>
</Match>
<Match when={activeTab() === 'calls' && ENABLE_CALLS}>
- <ChannelCallsTab channelId={channelId} />
+ <DebugSuspense name="ChannelDetail.calls">
+ <ChannelCallsTab channelId={channelId} />
+ </DebugSuspense>
</Match>
<Match when={activeTab() === 'participants'}>
- <ChannelParticipantsTab
- channelId={channelId}
- botManagementEnabled={botManagement.enabled()}
- onCreateBot={botManagement.openCreateBot}
- inviteBotFocusRequest={botManagement.inviteFocusRequest()}
- onOpenBot={botManagement.openBot}
- />
+ <DebugSuspense name="ChannelDetail.participants">
+ <ChannelParticipantsTab
+ channelId={channelId}
+ botManagementEnabled={botManagement.enabled()}
+ onCreateBot={botManagement.openCreateBot}
+ inviteBotFocusRequest={botManagement.inviteFocusRequest()}
+ onOpenBot={botManagement.openBot}
+ />
+ </DebugSuspense>
</Match>
<Match when={activeTab() === 'call' && canUseInlineCallTab()}>
- <ChannelCallTab
- channelId={channelId}
- pendingJoin={pendingJoinCall}
- />
+ <DebugSuspense name="ChannelDetail.call">
+ <ChannelCallTab
+ channelId={channelId}
+ pendingJoin={pendingJoinCall}
+ />
+ </DebugSuspense>
</Match>
</Switch>
</div>
@@ -393,7 +421,11 @@ function ChannelDetailContent(props: ChannelDetailProps) {
export function ChannelDetail(props: ChannelDetailProps) {
return (
<Show when={props.channelId} keyed>
- {(channelId) => <ChannelDetailContent {...props} channelId={channelId} />}
+ {(channelId) => (
+ <DebugSuspense name="ChannelDetail.root">
+ <ChannelDetailContent {...props} channelId={channelId} />
+ </DebugSuspense>
+ )}
</Show>
);
}
diff --git a/apps/web/src/features/channel/DebugSuspense.tsx b/apps/web/src/features/channel/DebugSuspense.tsx
index bf969fafca..1e447f4eba 100644
--- a/apps/web/src/features/channel/DebugSuspense.tsx
+++ b/apps/web/src/features/channel/DebugSuspense.tsx
@@ -3,16 +3,23 @@ import { type JSX, Suspense } from 'solid-js';
type DebugSuspenseProps = {
name: string;
children: JSX.Element;
+ fallback?: JSX.Element;
};
-function DebugSuspenseFallback(props: Pick<DebugSuspenseProps, 'name'>) {
+function DebugSuspenseFallback(
+ props: Pick<DebugSuspenseProps, 'name' | 'fallback'>
+) {
console.log(`suspense triggers ${props.name}`);
- return null;
+ return <>{props.fallback}</>;
}
export function DebugSuspense(props: DebugSuspenseProps) {
return (
- <Suspense fallback={<DebugSuspenseFallback name={props.name} />}>
+ <Suspense
+ fallback={
+ <DebugSuspenseFallback name={props.name} fallback={props.fallback} />
+ }
+ >
{props.children}
</Suspense>
);
diff --git a/apps/web/src/features/channels-view/channels-view.tsx b/apps/web/src/features/channels-view/channels-view.tsx
index 36673e239d..660991cdee 100644
--- a/apps/web/src/features/channels-view/channels-view.tsx
+++ b/apps/web/src/features/channels-view/channels-view.tsx
@@ -3,6 +3,7 @@ import { markChannelNotificationsSeenOnOpen } from '@app/features/next-soup/util
import { MaybeSoupEntityActionDrawerManager } from '@app/features/soup';
import { withEntityNotifications } from '@app/features/soup/entity-notifications';
import { SplitRouter } from '@app/lib/split-router';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { SplitPanel } from '@components/app/split-panel';
@@ -17,7 +18,6 @@ import {
on,
onMount,
Show,
- Suspense,
useContext,
} from 'solid-js';
import { ChannelsViewProvider, useChannelsView } from './channels-view-context';
@@ -79,34 +79,40 @@ function ChannelsViewRoot() {
resizable
>
<ViewShell.Aside onWidthChangeEnd={setAsideWidth}>
- <ChannelsRail
- sources={sources}
- searchOpen={railSearchOpen()}
- onSearchOpenChange={setRailSearchOpen}
- />
+ <DebugSuspense name="ChannelsView.rail">
+ <ChannelsRail
+ sources={sources}
+ searchOpen={railSearchOpen()}
+ onSearchOpenChange={setRailSearchOpen}
+ />
+ </DebugSuspense>
</ViewShell.Aside>
<ViewShell.Main class="overflow-hidden">
<ChannelSourcesContext.Provider value={sources}>
- <SplitRouter.Outlet
- fallback={() => (
- <>
- <ViewShell.TopBar>
- <span class="text-sm font-semibold">Chat</span>
- </ViewShell.TopBar>
- <div class="flex min-h-0 flex-1 items-center justify-center px-6 text-center">
- <div class="flex max-w-sm flex-col gap-2">
- <h2 class="text-base font-semibold text-ink">
- Select a conversation
- </h2>
- <p class="text-sm leading-5 text-ink-muted">
- Choose a channel or person from the sidebar
- to open the conversation here.
- </p>
+ <DebugSuspense name="ChannelsView.outlet">
+ <SplitRouter.Outlet
+ fallback={() => (
+ <>
+ <ViewShell.TopBar>
+ <span class="text-sm font-semibold">
+ Chat
+ </span>
+ </ViewShell.TopBar>
+ <div class="flex min-h-0 flex-1 items-center justify-center px-6 text-center">
+ <div class="flex max-w-sm flex-col gap-2">
+ <h2 class="text-base font-semibold text-ink">
+ Select a conversation
+ </h2>
+ <p class="text-sm leading-5 text-ink-muted">
+ Choose a channel or person from the
+ sidebar to open the conversation here.
+ </p>
+ </div>
</div>
- </div>
- </>
- )}
- />
+ </>
+ )}
+ />
+ </DebugSuspense>
</ChannelSourcesContext.Provider>
</ViewShell.Main>
</ViewShell.Root>
@@ -114,7 +120,8 @@ function ChannelsViewRoot() {
}
>
<MaybeSoupEntityActionDrawerManager>
- <Suspense
+ <DebugSuspense
+ name="ChannelsView.mobile"
fallback={
<div class="grid size-full place-items-center text-ink-muted">
<SpinnerIcon
@@ -129,7 +136,7 @@ function ChannelsViewRoot() {
tab={state.mobileTab}
onTabChange={setMobileTab}
/>
- </Suspense>
+ </DebugSuspense>
</MaybeSoupEntityActionDrawerManager>
</Show>
</SplitPanel.Body>
@@ -139,7 +146,7 @@ function ChannelsViewRoot() {
);
}
-export function ChannelDetailRouteView() {
+function ChannelDetailRouteContent() {
const { selectedChannel } = useChannelsView();
const notificationSource = useGlobalNotificationSource();
const channelId = () => selectedChannel()?.id;
@@ -211,7 +218,7 @@ export function ChannelDetailRouteView() {
);
return (
- <Suspense>
+ <DebugSuspense name="ChannelsView.detail-content">
<Show
when={hydrated()}
fallback={
@@ -231,15 +238,25 @@ export function ChannelDetailRouteView() {
>
{(channel) => <ChannelDetailView channel={channel()} />}
</Show>
- </Suspense>
+ </DebugSuspense>
+ );
+}
+
+export function ChannelDetailRouteView() {
+ return (
+ <DebugSuspense name="ChannelsView.detail-route">
+ <ChannelDetailRouteContent />
+ </DebugSuspense>
);
}
/** Chat workspace with shared workspace navigation. */
export function ChannelsView(props: ChannelsViewProps) {
return (
- <ChannelsViewProvider initialState={props.initialState}>
- <ChannelsViewRoot />
- </ChannelsViewProvider>
+ <DebugSuspense name="ChannelsView.root">
+ <ChannelsViewProvider initialState={props.initialState}>
+ <ChannelsViewRoot />
+ </ChannelsViewProvider>
+ </DebugSuspense>
);
}
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
index bba5c31b8a..4497011c8d 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
@@ -3,6 +3,7 @@ import {
CollapsibleSection as WorkspaceSection,
} from '@app/components/view-shell';
import { CollapseTransition } from '@app/components/view-shell/CollapseTransition';
+import { DebugSuspense } from '@channel/DebugSuspense';
import CaretDownIcon from '@phosphor/caret-down.svg';
import CaretUpIcon from '@phosphor/caret-up.svg';
import PlusIcon from '@phosphor/plus.svg';
@@ -15,7 +16,6 @@ import {
type JSX,
Match,
Show,
- Suspense,
Switch,
useContext,
} from 'solid-js';
@@ -48,7 +48,11 @@ function SectionScrollArea(props: {
}}
>
<div role="group" class={props.class}>
- <Suspense>{props.children}</Suspense>
+ <DebugSuspense
+ name={`ChannelsView.rail-section.${props.activityLabel ?? props.activityTargetId ?? 'unknown'}`}
+ >
+ {props.children}
+ </DebugSuspense>
</div>
</Scroll>
<Show when={activity.direction()}>
diff --git a/apps/web/src/features/channels-view/live-calls-sidebar.tsx b/apps/web/src/features/channels-view/live-calls-sidebar.tsx
index 8df09443b9..cc2dead11f 100644
--- a/apps/web/src/features/channels-view/live-calls-sidebar.tsx
+++ b/apps/web/src/features/channels-view/live-calls-sidebar.tsx
@@ -1,8 +1,9 @@
import { getMeetingPath, getMeetingShareToken } from '@channel/Call/call-link';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { useUserId } from '@core/context/user';
import { idToDisplayName } from '@core/user/util';
import { useNavigate } from '@solidjs/router';
-import { Show, Suspense } from 'solid-js';
+import { Show } from 'solid-js';
import { LiveCallsSidebar } from '../meetings/components/live-calls-sidebar';
import { useActiveQuickCallsSource } from '../meetings/queries/active-quick-calls';
import { useQuickCallsFlag } from '../meetings/use-quick-calls-flag';
@@ -36,9 +37,9 @@ export function ChannelsLiveCallsSidebar() {
const flag = useQuickCallsFlag();
return (
<Show when={!flag().loading && flag().enabled}>
- <Suspense>
+ <DebugSuspense name="ChannelsView.live-calls">
<ChannelsLiveCalls />
- </Suspense>
+ </DebugSuspense>
</Show>
);
}
diff --git a/apps/web/src/features/home/home-chat-input.tsx b/apps/web/src/features/home/home-chat-input.tsx
index 27a418de2a..bdfb6e42eb 100644
--- a/apps/web/src/features/home/home-chat-input.tsx
+++ b/apps/web/src/features/home/home-chat-input.tsx
@@ -1,4 +1,5 @@
import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { buildChatEditor } from '@core/component/AI/component/input/buildChatEditor';
import type { ChatSendInput } from '@core/component/AI/component/input/buildRequest';
@@ -17,7 +18,7 @@ import { createRenameDssEntityMutation } from '@entity';
import { invalidateAllSoup } from '@queries/soup/normalized-cache';
import { cognitionApiServiceClient } from '@service-cognition/client';
import { $getRoot } from 'lexical';
-import { createEffect, Show, Suspense } from 'solid-js';
+import { createEffect, Show } from 'solid-js';
import { HomeAgentComposer } from './home-agent-composer';
import { replaceHomeComposerDraft } from './home-composer-selection';
@@ -37,10 +38,20 @@ export type HomeChatInputProps = {
export const HomeChatInput = (props: HomeChatInputProps) => {
const flag = useFeatureFlag(enableChatV3Agents);
return (
- <Show when={flag().enabled} fallback={<LegacyHomeChatInput {...props} />}>
- <Suspense fallback={<div class="min-h-24" />}>
+ <Show
+ when={flag().enabled}
+ fallback={
+ <DebugSuspense name="Home.legacy-composer">
+ <LegacyHomeChatInput {...props} />
+ </DebugSuspense>
+ }
+ >
+ <DebugSuspense
+ name="Home.agent-composer"
+ fallback={<div class="min-h-24" />}
+ >
<HomeAgentComposer autoFocus={props.autoFocusOnMount} />
- </Suspense>
+ </DebugSuspense>
</Show>
);
};
diff --git a/apps/web/src/features/home/home-recent-sessions.tsx b/apps/web/src/features/home/home-recent-sessions.tsx
index fac2b4c3cb..c1d13fb017 100644
--- a/apps/web/src/features/home/home-recent-sessions.tsx
+++ b/apps/web/src/features/home/home-recent-sessions.tsx
@@ -1,5 +1,6 @@
import { QUERY_FILTERS_BASE } from '@app/features/next-soup/filters/query-filters';
import { globalSplitManager } from '@app/signal/splitLayout';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { useSplitPanel } from '@components/app/split-layout/layoutUtils';
import { ChatProviderIcon } from '@entity/components/ChatProviderIcon';
import ChevronRightIcon from '@phosphor/caret-right.svg';
@@ -8,7 +9,7 @@ import {
useSoupItemsQuery,
} from '@queries/soup/items';
import { formatDistanceToNowStrict } from 'date-fns';
-import { ErrorBoundary, For, Show, Suspense } from 'solid-js';
+import { ErrorBoundary, For, Show } from 'solid-js';
const DEFAULT_LIMIT = 3;
@@ -36,9 +37,9 @@ export function useRecentChatSessions(limit = DEFAULT_LIMIT) {
export function RecentSessionsSection(props: { limit?: number }) {
return (
<ErrorBoundary fallback={() => null}>
- <Suspense fallback={null}>
+ <DebugSuspense name="Home.recent-sessions" fallback={null}>
<RecentSessionsContent limit={props.limit} />
- </Suspense>
+ </DebugSuspense>
</ErrorBoundary>
);
}
diff --git a/apps/web/src/features/home/home-section-boundary.tsx b/apps/web/src/features/home/home-section-boundary.tsx
index 772ee6df6c..579f14dea1 100644
--- a/apps/web/src/features/home/home-section-boundary.tsx
+++ b/apps/web/src/features/home/home-section-boundary.tsx
@@ -1,13 +1,8 @@
+import { DebugSuspense } from '@channel/DebugSuspense';
import RefreshIcon from '@phosphor/arrow-clockwise.svg';
import WarningIcon from '@phosphor/warning.svg';
import { Button } from '@ui';
-import {
- createSignal,
- ErrorBoundary,
- type JSX,
- Show,
- Suspense,
-} from 'solid-js';
+import { createSignal, ErrorBoundary, type JSX, Show } from 'solid-js';
interface HomeSectionBoundaryProps {
title: string;
@@ -97,7 +92,8 @@ export function HomeSectionBoundary(props: HomeSectionBoundaryProps) {
/>
)}
>
- <Suspense
+ <DebugSuspense
+ name={`Home.section.${props.title}`}
fallback={
props.fallback === undefined ? (
<HomeSectionFallback />
@@ -107,7 +103,7 @@ export function HomeSectionBoundary(props: HomeSectionBoundaryProps) {
}
>
{props.children}
- </Suspense>
+ </DebugSuspense>
</ErrorBoundary>
);
}
diff --git a/apps/web/src/features/home/home.tsx b/apps/web/src/features/home/home.tsx
index 39e1b3d5f8..da13c9238b 100644
--- a/apps/web/src/features/home/home.tsx
+++ b/apps/web/src/features/home/home.tsx
@@ -1,4 +1,5 @@
import { ShowFeatureFlag } from '@app/lib/analytics/posthog';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { FloatRegionOrInline } from '@components/app/mobile/float-regions/FloatRegion';
import { DragDropWrapper } from '@core/component/AI/component/DragDrop';
import { ChatInputProvider } from '@core/component/AI/context';
@@ -57,13 +58,15 @@ function getGreeting() {
export function Home() {
return (
- <ShowFeatureFlag flag={enableHomeView} fallback={<Navigate href="/" />}>
- <ChatInputProvider>
- <DragDropWrapper class="relative size-full">
- <HomeContent />
- </DragDropWrapper>
- </ChatInputProvider>
- </ShowFeatureFlag>
+ <DebugSuspense name="Home.root">
+ <ShowFeatureFlag flag={enableHomeView} fallback={<Navigate href="/" />}>
+ <ChatInputProvider>
+ <DragDropWrapper class="relative size-full">
+ <HomeContent />
+ </DragDropWrapper>
+ </ChatInputProvider>
+ </ShowFeatureFlag>
+ </DebugSuspense>
);
}
@@ -131,12 +134,14 @@ function HomeContent() {
</div>
</div>
- <FloatRegionOrInline region="accessory">
- <div class="mx-auto w-full max-w-3xl shrink-0 px-4 pb-3 pointer-events-auto touch:px-(--mobile-chrome-gutter) touch:pb-0">
- <HomeChatInput />
- <HomeGettingStartedLink preferences={preferences} />
- </div>
- </FloatRegionOrInline>
+ <DebugSuspense name="Home.accessory">
+ <FloatRegionOrInline region="accessory">
+ <div class="mx-auto w-full max-w-3xl shrink-0 px-4 pb-3 pointer-events-auto touch:px-(--mobile-chrome-gutter) touch:pb-0">
+ <HomeChatInput />
+ <HomeGettingStartedLink preferences={preferences} />
+ </div>
+ </FloatRegionOrInline>
+ </DebugSuspense>
</main>
);
}
diff --git a/apps/web/src/features/inbox-view/inbox-view.tsx b/apps/web/src/features/inbox-view/inbox-view.tsx
index 70e0292279..dda7a69da1 100644
--- a/apps/web/src/features/inbox-view/inbox-view.tsx
+++ b/apps/web/src/features/inbox-view/inbox-view.tsx
@@ -2,6 +2,7 @@ import { useViewShell, ViewShell } from '@app/components/view-shell';
import { calendarSearch } from '@app/features/calendar-view/calendar-url';
import { CalendarView } from '@app/features/calendar-view/calendar-view';
import { createSearchParams, SplitRouter } from '@app/lib/split-router';
+import { DebugSuspense } from '@channel/DebugSuspense';
import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';
import { PreviewFrame, PreviewPanel } from '@components/app/PreviewPanel';
import type { PreviewSelection } from '@components/app/previewTarget';
@@ -11,7 +12,7 @@ import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@phosphor/spinner.svg';
-import { createEffect, onMount, Show, Suspense } from 'solid-js';
+import { createEffect, onMount, Show } from 'solid-js';
import { HomeChatStart } from './components/HomeChatStart';
import { HomeReturnBreadcrumb } from './components/HomeReturnBreadcrumb';
import { InboxListLayout } from './components/InboxHeader';
@@ -46,19 +47,23 @@ function HomeListPane(props: {
return (
<InboxListLayout
- tabs={<InboxTabs />}
+ tabs={
+ <DebugSuspense name="InboxView.tabs">
+ <InboxTabs />
+ </DebugSuspense>
+ }
onNewChat={() => {
props.onNewChat();
showContent();
}}
>
- <Suspense fallback={<InboxFallback />}>
+ <DebugSuspense name="InboxView.list" fallback={<InboxFallback />}>
<InboxList
hasPreview={props.hasPreview}
onPreviewEntityChange={props.onPreviewEntityChange}
onPreviewActivate={showContent}
/>
- </Suspense>
+ </DebugSuspense>
</InboxListLayout>
);
}
@@ -105,23 +110,28 @@ function InboxViewRoot() {
resizable
>
<ViewShell.Aside class="flex flex-col bg-panel">
- <HomeListPane
- hasPreview={
- previewTarget() !== undefined || calendarOpen()
- }
- onPreviewEntityChange={onPreviewEntityChange}
- onNewChat={newChat}
- />
+ <DebugSuspense name="InboxView.list-pane">
+ <HomeListPane
+ hasPreview={
+ previewTarget() !== undefined || calendarOpen()
+ }
+ onPreviewEntityChange={onPreviewEntityChange}
+ onNewChat={newChat}
+ />
+ </DebugSuspense>
</ViewShell.Aside>
<ViewShell.Main class="overflow-hidden">
{/* Detail routes load lazily. Suspend only this area, so
the list stays mounted and a pending detail's effects
wait until it resolves. */}
- <Suspense fallback={<InboxFallback />}>
+ <DebugSuspense
+ name="InboxView.outlet"
+ fallback={<InboxFallback />}
+ >
<SplitRouter.Outlet
fallback={() => <HomeChatStart />}
/>
- </Suspense>
+ </DebugSuspense>
</ViewShell.Main>
</ViewShell.Root>
</div>
@@ -129,11 +139,15 @@ function InboxViewRoot() {
>
<ViewShell.Root aside={false} main={{ min: 224 }}>
<ViewShell.Main>
- <HomeListPane
- hasPreview={previewTarget() !== undefined || calendarOpen()}
- onPreviewEntityChange={onPreviewEntityChange}
- onNewChat={newChat}
- />
+ <DebugSuspense name="InboxView.list-pane">
+ <HomeListPane
+ hasPreview={
+ previewTarget() !== undefined || calendarOpen()
+ }
+ onPreviewEntityChange={onPreviewEntityChange}
+ onNewChat={newChat}
+ />
+ </DebugSuspense>
</ViewShell.Main>
</ViewShell.Root>
</Show>
@@ -145,7 +159,7 @@ function InboxViewRoot() {
}
/** The Calendar view aimed at an event, inside Home's inline preview chrome. */
-export function InboxCalendarRouteView() {
+function InboxCalendarRouteContent() {
const panel = useSplitPanelOrThrow();
const { closePreview, calendarRefocus } = useInboxView();
const [search] = createSearchParams(calendarSearch);
@@ -163,14 +177,22 @@ export function InboxCalendarRouteView() {
);
}
-export function InboxDetailRouteView() {
+export function InboxCalendarRouteView() {
+ return (
+ <DebugSuspense name="InboxView.calendar-route">
+ <InboxCalendarRouteContent />
+ </DebugSuspense>
+ );
+}
+
+function InboxDetailRouteContent() {
const panel = useSplitPanelOrThrow();
const orchestrator = useGlobalBlockOrchestrator();
const { previewTarget, previewNavigationRequest, closePreview } =
useInboxView();
return (
- <Suspense>
+ <DebugSuspense name="InboxView.detail-content">
<PreviewPanel
target={previewTarget()}
navigationRequest={previewNavigationRequest()}
@@ -178,15 +200,25 @@ export function InboxDetailRouteView() {
splitPanelContext={panel}
headerLeading={<HomeReturnBreadcrumb onReturn={closePreview} />}
/>
- </Suspense>
+ </DebugSuspense>
+ );
+}
+
+export function InboxDetailRouteView() {
+ return (
+ <DebugSuspense name="InboxView.detail-route">
+ <InboxDetailRouteContent />
+ </DebugSuspense>
);
}
/** Composable heterogeneous Inbox built on the shared view and Soup primitives. */
export function InboxView(props: InboxViewProps) {
return (
- <InboxViewProvider initialState={props.initialState}>
- <InboxViewRoot />
- </InboxViewProvider>
+ <DebugSuspense name="InboxView.root">
+ <InboxViewProvider initialState={props.initialState}>
+ <InboxViewRoot />
+ </InboxViewProvider>
+ </DebugSuspense>
);
}
diff --git a/apps/web/src/lib/core/context/quickAccess/QuickAccessProvider.tsx b/apps/web/src/lib/core/context/quickAccess/QuickAccessProvider.tsx
index 829acc8048..02f6747269 100644
--- a/apps/web/src/lib/core/context/quickAccess/QuickAccessProvider.tsx
+++ b/apps/web/src/lib/core/context/quickAccess/QuickAccessProvider.tsx
@@ -1,4 +1,5 @@
-import { createMemo, type FlowComponent, Suspense } from 'solid-js';
+import { DebugSuspense } from '@channel/DebugSuspense';
+import { createMemo, type FlowComponent } from 'solid-js';
import { QuickAccessContextProvider } from './context';
import { createQuickAccessValue } from './QuickAccessSource';
import type {
@@ -49,7 +50,7 @@ const QuickAccessProviderValue: FlowComponent = (props) => {
};
export const QuickAccessProvider: FlowComponent = (props) => (
- <Suspense>
+ <DebugSuspense name="QuickAccess.root">
<QuickAccessProviderValue>{props.children}</QuickAccessProviderValue>
- </Suspense>
+ </DebugSuspense>
);
diff --git a/apps/web/src/lib/queries/soup/quick-access-pending.test.tsx b/apps/web/src/lib/queries/soup/quick-access-pending.test.tsx
new file mode 100644
index 0000000000..59965d676c
--- /dev/null
+++ b/apps/web/src/lib/queries/soup/quick-access-pending.test.tsx
@@ -0,0 +1,41 @@
+import { createRoot, createSignal } from 'solid-js';
+import { describe, expect, it, vi } from 'vitest';
+
+const mocks = vi.hoisted(() => ({ query: undefined as unknown }));
+
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: false }),
+}));
+vi.mock('@entity', () => ({
+ isSnippetEntity: (entity: { type: string }) => entity.type === 'snippet',
+}));
+vi.mock('@queries/soup/items', () => ({
+ useSoupItemsQuery: () => mocks.query,
+}));
+
+import { useQuickAccessSnippetsQuery } from './quick-access-snippets';
+
+describe('Quick Access snippets', () => {
+ it('does not read pending query data', () => {
+ createRoot((dispose) => {
+ const [pending, setPending] = createSignal(true);
+ const entity = { id: 'one', type: 'snippet' };
+ mocks.query = {
+ get isPending() {
+ return pending();
+ },
+ get data() {
+ if (pending()) throw new Error('Pending query data was read');
+ return [entity];
+ },
+ };
+
+ const { snippets } = useQuickAccessSnippetsQuery();
+ expect(snippets()).toEqual([]);
+
+ setPending(false);
+ expect(snippets()).toEqual([entity]);
+ dispose();
+ });
+ });
+});
diff --git a/apps/web/src/lib/queries/soup/quick-access-snippets.ts b/apps/web/src/lib/queries/soup/quick-access-snippets.ts
index 50eda783b9..500664a32b 100644
--- a/apps/web/src/lib/queries/soup/quick-access-snippets.ts
+++ b/apps/web/src/lib/queries/soup/quick-access-snippets.ts
@@ -2,6 +2,7 @@ import { QUERY_FILTERS_BASE } from '@app/features/next-soup/filters/query-filter
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { enableSnippets } from '@core/constant/featureFlags';
import { isSnippetEntity, type SnippetEntity } from '@entity';
+import { queryReadyGate } from '@queries/gate';
import { useSoupItemsQuery } from '@queries/soup/items';
import { createMemo } from 'solid-js';
@@ -37,8 +38,8 @@ export function useQuickAccessSnippetsQuery() {
() => ({ staleTime: STALE_TIME, enabled: snippetsFlag().enabled })
);
- const snippets = createMemo<SnippetEntity[]>(
- () => query.data?.filter(isSnippetEntity) ?? []
+ const snippets = createMemo<SnippetEntity[]>(() =>
+ queryReadyGate(query) ? query.data.filter(isSnippetEntity) : []
);
return { query, snippets };