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(customer-analytics): register one query mock per accounts story (#68802)

Paul D'Ambraf54599a07eae
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx
index 3679d9ccbd25..5a7fd1719b3f 100644
--- a/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx
+++ b/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx
@@ -232,14 +232,15 @@ const meta: Meta = {
waitForSelector: '[data-attr="accounts-refresh"]',
},
},
+ // NB: no QUERY_ENDPOINT mock here — every story registers exactly one query handler.
+ // Meta- and story-level decorators both worker.use() the same path, and their precedence
+ // can flip mid-story, so a meta-level query mock intermittently shadows the story's and
+ // answers billing/chart queries with an empty 200 (breaking the Usage tab canvas).
decorators: [
mswDecorator({
get: {
[WAREHOUSE_VIEW_LINK_ENDPOINT]: { count: 0, next: null, previous: null, results: [] },
},
- post: {
- [QUERY_ENDPOINT]: mockAccountsQuery(SAMPLE_ROWS),
- },
}),
],
}
@@ -249,6 +250,13 @@ type Story = StoryObj<{}>
export const Default: Story = {
render: () => <App />,
+ decorators: [
+ mswDecorator({
+ post: {
+ [QUERY_ENDPOINT]: mockAccountsQuery(SAMPLE_ROWS),
+ },
+ }),
+ ],
}
export const Empty: Story = {
@@ -272,6 +280,13 @@ export const FeatureGateOff: Story = {
waitForSelector: '[data-attr="not-found-page"]',
},
},
+ decorators: [
+ mswDecorator({
+ post: {
+ [QUERY_ENDPOINT]: mockAccountsQuery(SAMPLE_ROWS),
+ },
+ }),
+ ],
}
export const RowExpandedEmpty: Story = {