Skip to content

TanStack: Fix createServerFn validator mock - #35185

Merged
huang-julien merged 4 commits into
storybookjs:nextfrom
sjh9714:fix-tanstack-validator-mock
Jul 13, 2026
Merged

huang-julien merged 4 commits into
storybookjs:nextfrom
sjh9714:fix-tanstack-validator-mock

Conversation

@sjh9714

@sjh9714 sjh9714 commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #35174

What I did

Adds support for the TanStack Start createServerFn().validator(...).handler(...) chain in the @storybook/tanstack-react Start mock. The mock already treated inputValidator as a no-op builder step; validator now behaves the same way so stories using the documented TanStack Start validator syntax do not crash before handler() is mocked.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

No manual UI testing is needed for this mock-builder change. To verify manually, add a story or imported module that defines a server function with createServerFn().validator(...).handler(...); Storybook should load it without createServerFn(...).validator is not a function.

Commands run:

  • yarn install --immutable
  • yarn nx compile core
  • yarn vitest run --config code/frameworks/tanstack-react/vitest.config.ts code/frameworks/tanstack-react/src/export-mocks/start.test.ts (failed before the fix with createServerFn(...).validator is not a function, then passed after the fix)
  • cd code && yarn fmt:write
  • yarn nx compile eslint-plugin
  • yarn --cwd code lint:js:cmd frameworks/tanstack-react/src/export-mocks/start.ts frameworks/tanstack-react/src/export-mocks/start.test.ts
  • yarn vitest run --config code/frameworks/tanstack-react/vitest.config.ts code/frameworks/tanstack-react/src/export-mocks/start.test.ts code/frameworks/tanstack-react/src/export-mocks/react-router.test.ts
  • yarn nx compile tanstack-react
  • yarn nx check tanstack-react
  • yarn vitest run code/frameworks/tanstack-react/src/export-mocks/start.test.ts

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.

Summary by CodeRabbit

  • Tests

    • Added test verifying server function creation supports validator chain syntax patterns.
  • Chores

    • Extended mock server-function builder with a validator method to support fluent API patterns consistent with existing chainable methods.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 30976c70-5f5e-41e4-a486-c69c33bbfaa0

📥 Commits

Reviewing files that changed from the base of the PR and between beab22c and 3c58fb6.

📒 Files selected for processing (2)
  • code/frameworks/tanstack-react/src/export-mocks/start.test.ts
  • code/frameworks/tanstack-react/src/export-mocks/start.ts

📝 Walkthrough

Walkthrough

Adds a validator chainable method to the internal createMockServerFnBuilder in the TanStack React framework mock, following the existing pattern for options, middleware, and inputValidator. A corresponding Vitest test verifies the validator(...).handler(...) chain resolves correctly.

Changes

createServerFn mock validator chain

Layer / File(s) Summary
builder.validator method and chain test
code/frameworks/tanstack-react/src/export-mocks/start.ts, code/frameworks/tanstack-react/src/export-mocks/start.test.ts
Adds builder.validator returning a new createMockServerFnBuilder() instance at line 591–594, and a test asserting createServerFn().validator(...).handler(...) resolves to 'ok'.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sjh9714 sjh9714 changed the title Fix TanStack createServerFn validator mock TanStack: Fix createServerFn validator mock Jun 16, 2026
@github-actions github-actions Bot added the Stale label Jun 27, 2026
@sjh9714

sjh9714 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

The Danger failure is only asking for labels, but I don't have permission to add labels to this repo. Could a maintainer add the appropriate labels? Suggested based on this fix: bug, ci:normal, and qa:needed.

@theoludwig

Copy link
Copy Markdown

Any news? Would be cool to get this PR merged. cc @ndelangen @huang-julien @valentinpalkovic

@huang-julien huang-julien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@huang-julien huang-julien added bug ci:daily Run the CI jobs that normally run in the daily job. ci:normal Run our default set of CI jobs (choose this for most PRs). qa:skip Pull Requests that do not need any QA. (e.g. documentation) and removed ci:daily Run the CI jobs that normally run in the daily job. labels Jul 13, 2026
@storybook-app-bot

storybook-app-bot Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Package Benchmarks

Commit: af767bd, ran on 17 July 2026 at 12:20:42 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 73 73 0
Self size 21.32 MB 22.16 MB 🚨 +835 KB 🚨
Dependency size 36.44 MB 36.44 MB 0 B
Bundle Size Analyzer Link Link

@storybook/ember

Before After Difference
Dependency count 187 187 0
Self size 13 KB 15 KB 🚨 +2 KB 🚨
Dependency size 30.94 MB 30.94 MB 🎉 -652 B 🎉
Bundle Size Analyzer Link Link

@storybook/nextjs

Before After Difference
Dependency count 533 533 0
Self size 640 KB 663 KB 🚨 +23 KB 🚨
Dependency size 62.27 MB 62.31 MB 🚨 +34 KB 🚨
Bundle Size Analyzer Link Link

@storybook/nextjs-vite

Before After Difference
Dependency count 93 93 0
Self size 1.37 MB 1.39 MB 🚨 +22 KB 🚨
Dependency size 23.97 MB 24.01 MB 🚨 +38 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-native-web-vite

Before After Difference
Dependency count 122 122 0
Self size 29 KB 30 KB 🚨 +940 B 🚨
Dependency size 25.04 MB 25.08 MB 🚨 +38 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-vite

Before After Difference
Dependency count 83 83 0
Self size 32 KB 36 KB 🚨 +4 KB 🚨
Dependency size 21.75 MB 21.78 MB 🚨 +34 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 274 274 0
Self size 23 KB 23 KB 🚨 +777 B 🚨
Dependency size 48.06 MB 48.09 MB 🚨 +34 KB 🚨
Bundle Size Analyzer Link Link

@storybook/tanstack-react

Before After Difference
Dependency count 84 84 0
Self size 112 KB 110 KB 🎉 -2 KB 🎉
Dependency size 21.78 MB 21.82 MB 🚨 +38 KB 🚨
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 205 205 0
Self size 827 KB 827 KB 🚨 +84 B 🚨
Dependency size 91.32 MB 92.15 MB 🚨 +834 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 198 198 0
Self size 32 KB 32 KB 🎉 -115 B 🎉
Dependency size 89.80 MB 90.63 MB 🚨 +835 KB 🚨
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 74 74 0
Self size 1.09 MB 1.09 MB 🎉 -720 B 🎉
Dependency size 57.77 MB 58.60 MB 🚨 +835 KB 🚨
Bundle Size Analyzer node node

@storybook/react

Before After Difference
Dependency count 59 59 0
Self size 1.49 MB 1.52 MB 🚨 +35 KB 🚨
Dependency size 12.45 MB 12.45 MB 🚨 +81 B 🚨
Bundle Size Analyzer Link Link

@huang-julien
huang-julien enabled auto-merge July 13, 2026 09:26
@huang-julien
huang-julien disabled auto-merge July 13, 2026 12:20
@huang-julien
huang-julien enabled auto-merge July 13, 2026 12:20
@huang-julien
huang-julien merged commit 50b895a into storybookjs:next Jul 13, 2026
145 of 146 checks passed
@huang-julien huang-julien added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jul 14, 2026
@ndelangen ndelangen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jul 17, 2026
@ndelangen ndelangen added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jul 17, 2026
filipw01 pushed a commit to filipw01/storybook that referenced this pull request Jul 18, 2026
…tor-mock

TanStack: Fix createServerFn validator mock
(cherry picked from commit 50b895a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-scan:mixed bug ci:normal Run our default set of CI jobs (choose this for most PRs). needs triage patch:done Patch/release PRs already cherry-picked to main/release branch qa:skip Pull Requests that do not need any QA. (e.g. documentation) tanstack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: @storybook/tanstack-react createServerFn not properly mocked

5 participants