fix(storybook): mock INSIGHTS_ENDPOINT in expanded-row stories to prevent re-render collapse - #70243
Conversation
🤖 CI report
|
| File | Size | Δ vs base |
|---|---|---|
render-query/src/render-query/render-query.js |
21.25 MiB | 🔺 +15.3 KiB (+0.1%) |
posthog-app/_parent/products/replay_vision/frontend/replay_scanners/ActionEditorScene.js |
22.2 KiB | 🔺 +6.2 KiB (+39.2%) |
posthog-app/src/scenes/inbox/InboxScene.js |
659.0 KiB | 🔺 +5.0 KiB (+0.8%) |
exporter/src/queries/schema.js |
1.01 MiB | 🔺 +1.7 KiB (+0.2%) |
posthog-app/src/queries/schema.js |
1.01 MiB | 🔺 +1.7 KiB (+0.2%) |
posthog-app/src/scenes/insights/views/BoxPlot/BoxPlot.js |
4.7 KiB | 🟢 -1.3 KiB (-21.2%) |
exporter/src/lib/components/ActivityLog/describers.js |
128.4 KiB | 🔺 +1.3 KiB (+1.0%) |
posthog-app/src/lib/components/ActivityLog/describers.js |
131.3 KiB | 🔺 +1.3 KiB (+1.0%) |
exporter/src/scenes/insights/views/BoxPlot/BoxPlot.js |
3.2 KiB | 🟢 -1.2 KiB (-28.1%) |
Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report
✅ Eager graph — within budget
How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.
| Root | Eager (shipped) | Δ vs base | Budget |
|---|---|---|---|
entry (logged-out pages, app bootstrap)src/index.tsx |
1.22 MiB · 22 files | 🔺 +11.6 KiB (+0.9%) | ███░░░░░░░ 28.4% of 4.29 MiB |
authenticated shell (every logged-in page)src/scenes/AuthenticatedShell.tsx |
8.14 MiB · 2,977 files | 🔺 +16.5 KiB (+0.2%) | █████████░ 88.0% of 9.25 MiB |
🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
Largest files eagerly shipped from src/index.tsx
| Size | File |
|---|---|
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 24.6 KiB | ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js |
| 6.3 KiB | ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js |
| 4.5 KiB | ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js |
| 3.9 KiB | ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js |
| 1.4 KiB | ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js |
| 1.3 KiB | src/RootErrorBoundary.tsx |
| 912 B | ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js |
| 789 B | src/scenes/ChunkLoadErrorBoundary.tsx |
| 762 B | src/index.tsx |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 280.3 KiB | ../node_modules/.pnpm/posthog-js@1.400.1/node_modules/posthog-js/dist/rrweb.js |
| 267.7 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 234.9 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 222.7 KiB | ../node_modules/.pnpm/posthog-js@1.400.1/node_modules/posthog-js/dist/module.js |
| 164.0 KiB | src/queries/validators.js |
| 154.3 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/lib/api.ts |
| 93.3 KiB | ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js |
| 92.7 KiB | ../packages/quill/packages/quill/dist/index.js |
Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479
✅ Dist folder size — 🔺 +23.11 MiB (+1.8%)
Total size of the built frontend/dist folder (all assets), compared against the base branch.
Total: 1308.06 MiB · 🔺 +23.11 MiB (+1.8%)
…vent re-render collapse AccountNotebooksExpansion eagerly mounts accountBillingLogic for both usage and spend tabs, firing requests to the insights endpoint. Stories that only test the Notes/Links tabs (RowExpandedEmpty, RowExpandedWithNote, RowExpandedLinksDisabled) did not mock this endpoint, so the unhandled fetch could error and trigger a React re-render that collapses the expansion row — causing [data-attr="account-expansion"] to disappear and the post-play waitForSelector to time out (30s). Fix: - Add EXPANDED_ROW_DECORATORS_BASE with an empty INSIGHTS_ENDPOINT mock to all expanded-row stories - Bump waitForSelectorTimeout from 30s to 60s as a safety net for slow CI
…eout The RowExpandedUsagePopulated play function was waiting 30s for the DataVisualization canvas + 10s for sidebar text, which combined with test setup exceeded the 60s Jest test timeout. Move the canvas rendering check into the waitForSelector array (which runs in the test-runner's postVisit hook with its own 60s budget, separate from the Jest timeout). The play function now just switches to the Usage tab — the async canvas rendering is verified by waitForSelector before the snapshot fires.
2f5973b to
67fc009
Compare
|
✅ Visual changes approved by @rafaeelaudibert — baseline updated in 6 changed. Changed |
Skip sidebar link waits (findByText 'Useful links', 'Organization') in the play function — under CI load these can take 20-30s, and combined with the postVisit waitForSelector for '.DataVisualization canvas' they exceed the 60s Jest test timeout. Instead, do a minimal expand + tab-click in the play function and let the waitForSelector in testOptions handle verifying the canvas renders.
6 updated Run: e4087c58-bacf-48f6-a688-f2bd2b75a8f9 Co-authored-by: rafaeelaudibert <32079912+rafaeelaudibert@users.noreply.github.com>
…meout flake The RowExpandedEmpty, RowExpandedWithNote, and RowExpandedLinksDisabled stories use expandFirstRow() which calls findByText() for sidebar content with short default timeouts. Under CI load, React rendering of the mocked account data takes longer than the findByText budget, causing the play function to exhaust the 60s test timeout on retries. Simplify the play functions to only click-to-expand (matching the pattern that fixed RowExpandedUsagePopulated in #70243). The waitForSelector in testOptions already gates the snapshot on [data-attr="account-expansion"] with a 60s budget, making sidebar content verification in the play function redundant. Remove the now-unused expandFirstRow helper.
Summary
RowExpandedWithNote/RowExpandedUsagePopulatedVR tests that time out on[data-attr="account-expansion"]waitForSelectorAccountNotebooksExpansioneagerly mountsaccountBillingLogic(usage + spend), which fires requests to the insights endpoint. Stories without that mock see the unhandled fetch error trigger a React re-render that collapses the expansion row.EXPANDED_ROW_DECORATORS_BASEwith an emptyINSIGHTS_ENDPOINTmock to all affected storieswaitForSelectorTimeoutfrom 30s → 60s as a safety netFixes the flake seen in PR #70223 and PR #70236 (and ~25 other occurrences across unrelated branches).
Note
Created by Mendral. Tag @mendral-app with feedback or questions.