Skip to content

: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.

fix(inbox): show skeletons instead of placeholder badge/counts while loading (#65560)

Joshua Snyder1a96d61dca7f
diff --git a/frontend/src/scenes/inbox/components/shell/AgentSetupColumn.tsx b/frontend/src/scenes/inbox/components/shell/AgentSetupColumn.tsx
index 59f3091e0310..f62061c75c0d 100644
--- a/frontend/src/scenes/inbox/components/shell/AgentSetupColumn.tsx
+++ b/frontend/src/scenes/inbox/components/shell/AgentSetupColumn.tsx
@@ -41,7 +41,18 @@ interface SetupWidgetCardProps {
children?: React.ReactNode
}
-function TrailingAffordance({ tone, to }: { tone: WidgetTone; to?: string }): JSX.Element | null {
+function TrailingAffordance({
+ tone,
+ to,
+ loading,
+}: {
+ tone: WidgetTone
+ to?: string
+ loading?: boolean
+}): JSX.Element | null {
+ if (loading) {
+ return <LemonSkeleton className="h-4 w-12 rounded" />
+ }
if (tone === 'todo') {
return (
<LemonTag type="warning" size="small">
@@ -104,7 +115,7 @@ function SetupWidgetCard(props: SetupWidgetCardProps): JSX.Element {
) : (
<span className="text-xs text-secondary">{status}</span>
)}
- <TrailingAffordance tone={tone} to={to} />
+ <TrailingAffordance tone={tone} to={to} loading={loading} />
</div>
</>
) : (
@@ -120,7 +131,7 @@ function SetupWidgetCard(props: SetupWidgetCardProps): JSX.Element {
<div className="flex flex-col gap-0.5 min-w-0 flex-1">
<div className="flex items-center justify-between gap-1.5">
<span className={cn('text-default truncate', TITLE_CLASS[size])}>{title}</span>
- <TrailingAffordance tone={tone} to={to} />
+ <TrailingAffordance tone={tone} to={to} loading={loading} />
</div>
{loading ? (
<LemonSkeleton className="h-3 w-20" />
diff --git a/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx b/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx
index 4b57a2ebd61e..74fb389df9c5 100644
--- a/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx
+++ b/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx
@@ -1,7 +1,7 @@
import { useMountedLogic, useValues } from 'kea'
import { router } from 'kea-router'
-import { LemonTabs, LemonTag } from '@posthog/lemon-ui'
+import { LemonSkeleton, LemonTabs, LemonTag } from '@posthog/lemon-ui'
import { urls } from 'scenes/urls'
@@ -32,7 +32,12 @@ function isStaffOnlyTabKey(tab: InboxTabKey): boolean {
function FlatTabCount({ tabKey }: { tabKey: InboxFlatListTabKey }): JSX.Element {
const logic = reportListLogic({ tabKey, listParams: INBOX_FLAT_TAB_LIST_PARAMS[tabKey] })
useMountedLogic(logic)
- const { count } = useValues(logic)
+ const { count, countLoading } = useValues(logic)
+ // Skeleton only while the request is genuinely in flight; on failure `count` stays null,
+ // so fall back to the number (0) rather than a permanent skeleton.
+ if (count === null && countLoading) {
+ return <LemonSkeleton className="h-3 w-3 rounded" />
+ }
return <span className="text-xs text-muted tabular-nums">{count ?? 0}</span>
}
@@ -58,7 +63,7 @@ export function InboxTabBar({
showConfigTab?: boolean
onboarding?: boolean
}): JSX.Element {
- const { activeTab, isStaff, runsCount } = useValues(inboxSceneLogic)
+ const { activeTab, isStaff, runsCount, runsResponse, runsResponseLoading } = useValues(inboxSceneLogic)
const visibleTabKeys = INBOX_TAB_KEYS.filter(
(key) => (key !== 'config' || showConfigTab) && (!isStaffOnlyTabKey(key) || isStaff)
@@ -70,7 +75,12 @@ export function InboxTabBar({
<span className="flex items-center gap-1.5">
<span>{INBOX_TAB_LABEL[key]}</span>
{isFlatListTabKey(key) && <FlatTabCount tabKey={key} />}
- {key === 'runs' && <span className="text-xs text-muted tabular-nums">{runsCount}</span>}
+ {key === 'runs' &&
+ (runsResponse === null && runsResponseLoading ? (
+ <LemonSkeleton className="h-3 w-3 rounded" />
+ ) : (
+ <span className="text-xs text-muted tabular-nums">{runsCount}</span>
+ ))}
{isStaffOnlyTabKey(key) && (
<LemonTag type="completion" size="small">
Staff