Build: Move more stories out of next 13 sandbox#29593
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit fa533f1. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
8 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile
| import Testing from '../../assets/testing.png'; | ||
|
|
||
| // referenced from https://nextjs.org/docs/pages/api-reference/components/image#theme-detection-picture | ||
| const Component = (props: any) => { |
There was a problem hiding this comment.
style: props type 'any' should be more specific - consider creating an interface for the expected image props
| props: { srcSet: dark }, | ||
| } = getImageProps({ src: Accessibility, ...props }); |
There was a problem hiding this comment.
logic: destructuring could fail if getImageProps doesn't return expected shape - consider adding error handling
| loaders: async () => { | ||
| cookies().set('firstName', 'Jane'); | ||
| cookies().set({ | ||
| name: 'lastName', | ||
| value: 'Doe', | ||
| }); | ||
| headers().set('timezone', 'Central European Summer Time'); | ||
| }, |
There was a problem hiding this comment.
logic: The loader function doesn't return anything - should return an empty object to match Storybook loader API
| await step('Cookie and header store apis are called upon rendering', async () => { | ||
| await expect(cookiesMock.getAll).toHaveBeenCalled(); | ||
| await expect(headersMock.entries).toHaveBeenCalled(); | ||
| }); |
There was a problem hiding this comment.
style: These assertions only verify the methods were called but not their return values. Consider adding expectations for the actual cookie/header values.
| return ( | ||
| <> | ||
| <h3>Cookies:</h3> | ||
| {(await cookies()).getAll().map(({ name, value }) => { |
There was a problem hiding this comment.
style: Multiple calls to cookies() in render could cause performance issues. Consider moving the getAll() call outside the component or memoizing the result.
| export default async function Component() { | ||
| async function handleClick() { | ||
| 'use server'; | ||
| (await cookies()).set('user-id', 'encrypted-id'); |
There was a problem hiding this comment.
style: No error handling for failed cookie operations. Consider wrapping in try/catch.
| <form action={handleClick}> | ||
| <button>add user-id cookie</button> | ||
| </form> |
There was a problem hiding this comment.
style: Button lacks aria-label and descriptive text for accessibility
|
|
||
| import { redirect } from 'next/navigation'; | ||
|
|
||
| let state = 'Bug! Not invalidated'; |
There was a problem hiding this comment.
logic: Using a global variable for state management could cause issues in concurrent rendering and test isolation
| action={() => { | ||
| state = 'State is invalidated successfully.'; | ||
| redirect('/'); | ||
| }} |
There was a problem hiding this comment.
logic: Form action should be marked with 'use server' directive for Next.js server actions
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 69 | 69 | 0 |
| Self size | 4 KB | 4 KB | 0 B |
| Dependency size | 2.39 MB | 2.41 MB | 🚨 +17 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
…-again Build: Move more stories out of next 13 sandbox (cherry picked from commit 22df58c)
…-again Build: Move more stories out of next 13 sandbox (cherry picked from commit 22df58c)
Closes #
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake 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/coreteam 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
Added Next.js component stories to both default-ts and prerelease templates, focusing on theme-aware image loading, cookie/header functionality, and redirect behavior testing.
GetImageProps.stories.tsxin both templates demonstrating theme-based image switching usinggetImagePropsNextHeader.stories.tsxandNextHeader.tsxin both templates for testing cookie/header store APIs with mock functionalityRedirect.stories.tsxin both templates with temporary error handling for Next.js redirect testing