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(endpoints): add a skeleton for the scene loading state (#124888)

Jovan Sakovic67635ed193b7
diff --git a/products/endpoints/frontend/EndpointScene.tsx b/products/endpoints/frontend/EndpointScene.tsx
index 9db23f0555f1..4b4dba5b42d4 100644
--- a/products/endpoints/frontend/EndpointScene.tsx
+++ b/products/endpoints/frontend/EndpointScene.tsx
@@ -58,6 +58,7 @@ import { VersionBanner } from './endpoint-tabs/VersionBanner'
import { EndpointSceneHeader } from './EndpointHeader'
import { endpointLogic } from './endpointLogic'
import { EndpointTab, endpointSceneLogic } from './endpointSceneLogic'
+import { EndpointSceneSkeleton } from './EndpointSceneSkeleton'
import { endpointsLogic } from './endpointsLogic'
import { insightPickerEndpointModalLogic } from './insightPickerEndpointModalLogic'
@@ -361,8 +362,14 @@ export function EndpointScene(): JSX.Element {
onGoToLatest={() => setViewingVersion(null)}
/>
)}
- {!endpointLoading && <EndpointOverview />}
- {sceneMenuBarEnabled ? renderTabContent() : <LemonTabs activeKey={visibleTab} tabs={tabs} />}
+ {endpointLoading && !endpoint ? (
+ <EndpointSceneSkeleton showTabs={!sceneMenuBarEnabled} />
+ ) : (
+ <>
+ <EndpointOverview />
+ {sceneMenuBarEnabled ? renderTabContent() : <LemonTabs activeKey={visibleTab} tabs={tabs} />}
+ </>
+ )}
</SceneContent>
{endpoint && (
<ScenePanel>
diff --git a/products/endpoints/frontend/EndpointSceneSkeleton.stories.tsx b/products/endpoints/frontend/EndpointSceneSkeleton.stories.tsx
new file mode 100644
index 000000000000..c387c6b757f3
--- /dev/null
+++ b/products/endpoints/frontend/EndpointSceneSkeleton.stories.tsx
@@ -0,0 +1,28 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { EndpointSceneSkeleton } from './EndpointSceneSkeleton'
+
+const meta: Meta<typeof EndpointSceneSkeleton> = {
+ title: 'Endpoints/Endpoint scene skeleton',
+ component: EndpointSceneSkeleton,
+ parameters: {
+ testOptions: { snapshotBrowsers: [], waitForLoadersToDisappear: false },
+ },
+}
+export default meta
+
+type Story = StoryObj<typeof EndpointSceneSkeleton>
+
+export const Default: Story = {}
+
+export const WithoutTabs: Story = { args: { showTabs: false } }
+
+export const Narrow: Story = {
+ decorators: [
+ (Story) => (
+ <div className="w-120">
+ <Story />
+ </div>
+ ),
+ ],
+}
diff --git a/products/endpoints/frontend/EndpointSceneSkeleton.tsx b/products/endpoints/frontend/EndpointSceneSkeleton.tsx
new file mode 100644
index 000000000000..b356f85c5c8c
--- /dev/null
+++ b/products/endpoints/frontend/EndpointSceneSkeleton.tsx
@@ -0,0 +1,42 @@
+import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
+
+export function EndpointSceneSkeleton({ showTabs = true }: { showTabs?: boolean }): JSX.Element {
+ return (
+ <div role="status" className="flex flex-col gap-4">
+ <span className="sr-only">Loading endpoint</span>
+ <div aria-hidden="true" className="flex flex-col gap-4">
+ <div className="flex flex-wrap gap-x-8 gap-y-4">
+ {['w-28', 'w-24', 'w-48', 'w-28', 'w-28'].map((width, index) => (
+ <div key={index} className="flex flex-col gap-2">
+ <LemonSkeleton className="h-3 w-24" />
+ <LemonSkeleton className={`h-6 ${width}`} />
+ </div>
+ ))}
+ </div>
+ {showTabs && (
+ <div className="flex flex-wrap gap-4 border-b pb-3">
+ <LemonSkeleton className="h-5 w-12" />
+ <LemonSkeleton className="h-5 w-28" />
+ <LemonSkeleton className="h-5 w-16" />
+ <LemonSkeleton className="h-5 w-24" />
+ <LemonSkeleton className="h-5 w-12" />
+ <LemonSkeleton className="h-5 w-16" />
+ </div>
+ )}
+ <div className="overflow-hidden rounded border">
+ <div className="flex flex-wrap items-center justify-between gap-2 border-b p-3">
+ <LemonSkeleton className="h-5 w-24" />
+ <LemonSkeleton.Button className="w-20" size="small" />
+ </div>
+ <div className="flex h-96 flex-col gap-3 p-4">
+ <LemonSkeleton className="h-4 w-1/4" />
+ <LemonSkeleton className="h-4 w-2/3" />
+ <LemonSkeleton className="h-4 w-1/2" />
+ <LemonSkeleton className="h-4 w-3/5" />
+ <LemonSkeleton className="h-4 w-1/3" />
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}