Skip to content

feat(demo): publish Storybook alongside the demo site - #26

Merged
Eliav2 merged 1 commit into
mainfrom
feat/deploy-storybook
Aug 8, 2026
Merged

Eliav2 merged 1 commit into
mainfrom
feat/deploy-storybook

Conversation

@Eliav2

@Eliav2 Eliav2 commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Publishes Storybook as /storybook on the demo site, so deploy previews can show the stories.

Why

The stories are the only place the measurement behaviour is visible in a real browser, and nothing published them. Netlify builds the docs app; GitHub Pages deploys the same output. So the repros added for #21 and #23 existed only on a developer's machine — a deploy preview could show that the demo still worked, but never the bug the change was about.

Two problems this had to solve

1. Storybook was building the wrong thing, silently.

storybook build loads the project's vite.config.ts by default. The demo's has tanstackStart() and nitro(), which took over the build: Storybook emitted the demo app into .output/public, produced no story preview at all (no iframe.html, no assets/), and exited 0.

Fixed by giving Storybook its own config at .storybook/vite.config.ts, carrying only what the stories need — React, Tailwind, the @ alias, and the react-dom dedupe that keeps the library's flushSync from becoming a silent no-op. publicDir: false there, since the output now lands inside the public directory.

2. The output had to land somewhere the host actually serves.

viteStaticCopy writes to demo/dist, which nitro does not serve — that path was a dead end. demo/public/* is what ends up in .output/public (which is how vite.svg gets there), so Storybook builds straight into demo/public/storybook.

The base also has to match where the site is served from, since assets are requested from <demo base>/storybook/. Netlify serves from the root, GitHub Pages from the repository name, so main.ts derives it from GITHUB_PAGES exactly as demo/vite.config.ts derives its own.

Verified end to end

Not just that files exist — that it serves and renders:

/                       200
/storybook/             200
/storybook/iframe.html  200
/storybook/index.json   200
/storybook/assets/iframe-Dy-5ECWO.js   200   (the asset iframe.html actually references)

Then loaded Issues/Issue21 › FixedHeightIndicatorWraps from the served build and stepped it: stage 1 → Overview / Assets / Issues / More (2), stage 6 → Overview99+ / Assets99+ / More (3), measured rows: 1 throughout. So the published bundle carries working stories, not just a shell. 9 stories indexed.

CI

Builds Storybook and asserts iframe.html, index.json, and a non-zero story count. That silent-success failure mode is otherwise invisible until someone opens the page, and it is exactly what happened here during development.

Also

The demo's prebuild runs the Storybook build, so the two cannot fall out of step, and the header links to /storybook. demo/public/storybook/ is gitignored.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a Storybook link to the demo header for easier access to component previews.
    • Storybook is now built and available under the demo’s /storybook/ path.
  • Bug Fixes
    • Improved Storybook hosting support for root and GitHub Pages deployments.
  • Tests
    • Builds now verify that Storybook generates the expected preview, story index, and indexed stories.

The stories are the only place the measurement behaviour can be seen in a real
browser, and nothing published them: Netlify builds the docs app and GitHub Pages
deploys the same output, so the repros added for #21 and #23 existed only on a
developer's machine. Deploy previews could show that the demo still worked but
never the bug a change was about.

Storybook now builds into demo/public/storybook, so it rides along in whatever the
host serves — verified end to end by serving the built .output/public and loading a
story from it. The demo's prebuild runs it, so the two cannot fall out of step, and
the header links to it.

Two things this needed:

Storybook gets its own Vite config. It otherwise loads demo/vite.config.ts, whose
tanstack-start and nitro plugins take over the build: `storybook build` emitted the
demo app into .output/public, produced no story preview at all, and still exited 0.
.storybook/vite.config.ts carries only what the stories need — React, Tailwind, the
`@` alias, and the react-dom dedupe that keeps the library's flushSync working.

The base has to match where the site is served from, since the assets are requested
from `<demo base>/storybook/`. Netlify serves from the root and GitHub Pages from
the repository name, so it is derived from GITHUB_PAGES exactly as the demo derives
its own.

CI builds Storybook and asserts the preview and the story index exist, because the
silent-success failure above is otherwise invisible until someone opens the page.

Stacked on the tests branch to avoid a conflict in the demo's prebuild.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codesandbox

codesandbox Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web Editor • VS Code • Insiders

Open Preview

@netlify

netlify Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for react-responsive-overflow-list ready!

Name Link
🔨 Latest commit 2ace9cf
🔍 Latest deploy log https://app.netlify.com/projects/react-responsive-overflow-list/deploys/6a77766b571d99000858f22b
😎 Deploy Preview https://deploy-preview-26--react-responsive-overflow-list.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e0416b03-dbe6-4295-9c25-cefd56cb6af6

📥 Commits

Reviewing files that changed from the base of the PR and between 5b4aaaf and 2ace9cf.

📒 Files selected for processing (6)
  • .github/workflows/ci.yml
  • .gitignore
  • demo/.storybook/main.ts
  • demo/.storybook/vite.config.ts
  • demo/package.json
  • demo/src/components/layout/Header.tsx

📝 Walkthrough

Walkthrough

The demo now builds Storybook into public/storybook, links to it from the header, derives hosting paths for GitHub Pages, and validates the generated Storybook files in CI.

Changes

Storybook hosting integration

Layer / File(s) Summary
Storybook configuration
demo/.storybook/main.ts, demo/.storybook/vite.config.ts
Storybook now derives its hosting base, serves assets under /storybook/, and uses dedicated Vite plugins, aliases, and React package deduplication.
Storybook build wiring
demo/package.json, .gitignore
The demo prebuild runs build:storybook, which writes to public/storybook. Storybook output directories are ignored.
Storybook access and CI validation
demo/src/components/layout/Header.tsx, .github/workflows/ci.yml
The header links to the base-aware /storybook/ path. CI verifies iframe.html, index.json, and at least one indexed story.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CI
  participant DemoScripts as demo/package.json
  participant Storybook
  participant StorybookOutput as public/storybook
  CI->>DemoScripts: run pnpm build:storybook
  DemoScripts->>Storybook: build static Storybook
  Storybook->>StorybookOutput: write iframe.html and index.json
  CI->>StorybookOutput: validate generated files and story entries
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: publishing Storybook alongside the demo site.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/deploy-storybook

Comment @coderabbitai help to get the list of available commands.

@Eliav2
Eliav2 merged commit 1e5859c into main Aug 8, 2026
6 checks passed
@Eliav2
Eliav2 deleted the feat/deploy-storybook branch August 8, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant