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.

chore(storybook): silence noisy warnings in CI storybook build (#68898)

Thomas Obermüllerf12dbd6d78f1
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index 5c63d5dd4341..9fab2958becd 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -232,8 +232,9 @@ jobs:
# Consumed by the select-stories job below. Uploaded separately so
# the visual-regression matrix doesn't pay to download it on every
# shard.
+ # module-graph.json only exists once the Vite build completes, so no
+ # `if: always()`: on a failed/cancelled build it would just warn.
- name: Upload module-graph artifact
- if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: storybook-module-graph
diff --git a/common/storybook/.storybook/main.ts b/common/storybook/.storybook/main.ts
index 6079bfef7b13..bde345d00609 100644
--- a/common/storybook/.storybook/main.ts
+++ b/common/storybook/.storybook/main.ts
@@ -2,7 +2,7 @@ import type { StorybookConfig } from '@storybook/react-vite'
import tailwindcss from '@tailwindcss/vite'
import { fileURLToPath } from 'node:url'
import * as path from 'path'
-import { mergeConfig } from 'vite'
+import { mergeConfig, type Rollup } from 'vite'
import { frontendResolvePlugin } from './plugins/vite-frontend-resolve-plugin.ts'
import { moduleGraphPlugin } from './plugins/vite-module-graph-plugin.ts'
@@ -100,6 +100,20 @@ const config: StorybookConfig = {
optimizeDeps: {
include: ['buffer'],
},
+ build: {
+ rollupOptions: {
+ onwarn(warning: Rollup.RollupLog, defaultHandler: (warning: Rollup.RollupLog) => void) {
+ // "use client" directives from RSC-oriented deps (framer-motion, radix)
+ // are meaningless here, and barrel-file re-export cycles are endemic to
+ // the app's index.ts files. Together they bury real warnings in ~1000
+ // lines of noise per CI build.
+ if (warning.code === 'MODULE_LEVEL_DIRECTIVE' || warning.code === 'CYCLIC_CROSS_CHUNK_REEXPORT') {
+ return
+ }
+ defaultHandler(warning)
+ },
+ },
+ },
}),
docs: {
diff --git a/frontend/src/lib/ui/ContextMenu/ContextMenu.tsx b/frontend/src/lib/ui/ContextMenu/ContextMenu.tsx
index 129730722b67..67367491c229 100644
--- a/frontend/src/lib/ui/ContextMenu/ContextMenu.tsx
+++ b/frontend/src/lib/ui/ContextMenu/ContextMenu.tsx
@@ -1,5 +1,3 @@
-'use client'
-
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu'
import * as React from 'react'