Skip to content

Conversation

kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Sep 4, 2025

Closes #

What I did

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

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

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

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Greptile Summary

Updated On: 2025-09-04 12:19:23 UTC

This PR creates the foundational structure for a new @storybook/nextjs-vite-rsc framework that supports React Server Components (RSC) with Vite as the build tool. The implementation closely mirrors the existing nextjs-vite framework but establishes a separate package to handle RSC-specific requirements.

The changes include:

  • Core framework structure: New package configuration, TypeScript types, build config, and preset files that define the framework's integration with Storybook
  • RSC-specific components: Template components like RSC.tsx and NextHeader.tsx that demonstrate server components, server actions, and async functionality
  • Mock implementations: Complete mocking layer for Next.js server-side APIs (headers, cookies, cache, navigation, router) to enable RSC testing in Storybook
  • Decorators and providers: Head management, styled-jsx, routing, and image context providers that wrap stories with necessary Next.js context
  • Template structure: CLI templates and example stories covering various Next.js features (Image, Link, fonts, dynamic imports, server actions) adapted for RSC
  • Build and development setup: Vite plugin integration, ESLint configuration, and TypeScript declarations

The framework reuses significant portions of the existing nextjs-vite implementation while creating a distinct package path that allows for RSC-specific customizations. The template includes comprehensive examples demonstrating authentication flows, cookie/header management, and server component patterns that are essential for RSC development.

Confidence score: 2/5

  • This PR contains critical naming inconsistencies and import path errors that will cause runtime failures
  • Score reflects multiple framework name mismatches (using 'nextjs-vite' instead of 'nextjs-vite-rsc') and incorrect import references throughout the codebase
  • Pay close attention to package.json, project.json, preset.ts, portable-stories.ts, and all story files with incorrect import statements

Copy link
Contributor

github-actions bot commented Sep 4, 2025

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","build","dependencies"]

🚫

PR is not labeled with one of: ["ci:normal","ci:merged","ci:daily","ci:docs"]

🚫 PR title must be in the format of "Area: Summary", With both Area and Summary starting with a capital letter Good examples: - "Docs: Describe Canvas Doc Block" - "Svelte: Support Svelte v4" Bad examples: - "add new api docs" - "fix: Svelte 4 support" - "Vue: improve docs"

Generated by 🚫 dangerJS against 4483a66

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

69 files reviewed, 45 comments

Edit Code Review Bot Settings | Greptile


export const RSC = async ({ label }: { label: string }) => <>RSC {label}</>;

export const Nested = async ({ children }: any) => <>Nested {children}</>;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using a more specific type instead of any for children prop. Could use React.ReactNode for better type safety.

Suggested change
export const Nested = async ({ children }: any) => <>Nested {children}</>;
export const Nested = async ({ children }: { children: React.ReactNode }) => <>Nested {children}</>;

@@ -0,0 +1,93 @@
Copyright 2020 The Rubik Filtered Project Authors (https://https://github.com/NaN-xyz/Rubik-Filtered)
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: URL has duplicate 'https://' protocol - should be 'https://github.com/NaN-xyz/Rubik-Filtered'

Suggested change
Copyright 2020 The Rubik Filtered Project Authors (https://https://github.com/NaN-xyz/Rubik-Filtered)
Copyright 2020 The Rubik Filtered Project Authors (https://github.com/NaN-xyz/Rubik-Filtered)

@@ -0,0 +1,54 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Import should be from '@storybook/nextjs-vite-rsc' to match the new framework package being created, not '@storybook/nextjs-vite'

Suggested change
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
import type { Meta, StoryObj } from '@storybook/nextjs-vite-rsc';

*
* ```jsx
* // setup-file.js
* import { setProjectAnnotations } from '@storybook/nextjs-vite';
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Package name should be '@storybook/nextjs-vite-rsc' to match the actual framework name

Suggested change
* import { setProjectAnnotations } from '@storybook/nextjs-vite';
* import { setProjectAnnotations } from '@storybook/nextjs-vite-rsc';

test: {
// This is needed until Next will update to the React 19 beta: https://github.com/vercel/next.js/pull/65058
// In the React 19 beta ErrorBoundary errors (such as redirect) are only logged, and not thrown.
// We will also suspress console.error logs for re the console.error logs for redirect in the next framework.
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Typo in comment: 'suspress' should be 'suppress'

Suggested change
// We will also suspress console.error logs for re the console.error logs for redirect in the next framework.
// We will also suppress console.error logs for re the console.error logs for redirect in the next framework.

Comment on lines +3 to +4
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
import { getRouter } from '@storybook/nextjs-vite/navigation.mock';
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Import paths should reference '@storybook/nextjs-vite-rsc' instead of '@storybook/nextjs-vite' for the RSC framework

Suggested change
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
import { getRouter } from '@storybook/nextjs-vite/navigation.mock';
import type { Meta, StoryObj } from '@storybook/nextjs-vite-rsc';
import { getRouter } from '@storybook/nextjs-vite-rsc/navigation.mock';

{
exportEntries: ['./preset'],
entryPoint: './src/preset.ts',
dts: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Missing dts: false for mock entries - mock modules in browser entries should have TypeScript declaration generation disabled to match the pattern used in the existing nextjs framework

@@ -0,0 +1,8 @@
{
"name": "nextjs-vite",
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Project name should be 'nextjs-vite-rsc' to match the directory name and avoid conflicts with existing nextjs-vite framework

Suggested change
"name": "nextjs-vite",
"name": "nextjs-vite-rsc",

Comment on lines +17 to +21
const HeadManagerProvider: React.FC<PropsWithChildren> = ({ children }) => {
const headManager: HeadManagerValue = useMemo(initHeadManager, []);
headManager.getIsSsr = () => false;

return <HeadManagerContext.Provider value={headManager}>{children}</HeadManagerContext.Provider>;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: This implementation is identical to the existing nextjs-vite framework. Consider extracting this into a shared utility to reduce code duplication between the two frameworks.

@@ -0,0 +1,22 @@
import { fn } from 'storybook/test';

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: incomplete biome-ignore comment lacks proper explanation

Suggested change
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
// biome-ignore lint/suspicious/noExplicitAny: Callback function needs to accept any arguments and return any Promise for Next.js cache API compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants