Skip to content

Build: Move more stories out of next 13 sandbox#29593

Merged
yannbf merged 1 commit into
nextfrom
yann/fix-next-13-sandboxes-again
Nov 12, 2024
Merged

Build: Move more stories out of next 13 sandbox#29593
yannbf merged 1 commit into
nextfrom
yann/fix-next-13-sandboxes-again

Conversation

@yannbf
Copy link
Copy Markdown
Member

@yannbf yannbf commented Nov 12, 2024

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>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 78.2 MB 78.2 MB 0 B 1.25 0%
initSize 143 MB 143 MB -1.63 kB 1.36 0%
diffSize 65.2 MB 65.2 MB -1.63 kB 0.86 0%
buildSize 6.88 MB 6.88 MB 0 B 1.72 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B 0.82 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 0 B 1.73 0%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 0 B 1.72 0%
buildPreviewSize 3 MB 3 MB 0 B - 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 10.3s 14.6s 4.2s 0.02 29.3%
generateTime 22.5s 21.5s -979ms -0.16 -4.5%
initTime 15.5s 15.1s -390ms -0.1 -2.6%
buildTime 9s 8.6s -428ms -0.31 -5%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.8s 5.3s -1s -428ms -0.87 -26.6%
devManagerResponsive 4.3s 3.3s -1s -34ms -0.93 -31.1%
devManagerHeaderVisible 685ms 497ms -188ms -1.15 -37.8%
devManagerIndexVisible 815ms 580ms -235ms -0.65 -40.5%
devStoryVisibleUncached 1.3s 1s -328ms -0.47 -32.7%
devStoryVisible 721ms 527ms -194ms -1.21 -36.8%
devAutodocsVisible 587ms 463ms -124ms -0.86 -26.8%
devMDXVisible 624ms 480ms -144ms -0.56 -30%
buildManagerHeaderVisible 612ms 519ms -93ms -0.79 -17.9%
buildManagerIndexVisible 623ms 535ms -88ms -0.77 -16.4%
buildStoryVisible 610ms 520ms -90ms -0.74 -17.3%
buildAutodocsVisible 584ms 433ms -151ms -0.54 -34.9%
buildMDXVisible 511ms 429ms -82ms -0.51 -19.1%

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.

  • Added GetImageProps.stories.tsx in both templates demonstrating theme-based image switching using getImageProps
  • Added NextHeader.stories.tsx and NextHeader.tsx in both templates for testing cookie/header store APIs with mock functionality
  • Added Redirect.stories.tsx in both templates with temporary error handling for Next.js redirect testing
  • Included proper type definitions and testing assertions across all new story files
  • Added configuration for handling redirect errors until Next.js updates to React 19 beta

@yannbf yannbf added build Internal-facing build tooling & test updates ci:daily Run the CI jobs that normally run in the daily job. labels Nov 12, 2024
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Nov 12, 2024

☁️ Nx Cloud Report

CI 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 target

Sent with 💌 from NxCloud.

Copy link
Copy Markdown
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.

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) => {
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.

style: props type 'any' should be more specific - consider creating an interface for the expected image props

Comment on lines +13 to +14
props: { srcSet: dark },
} = getImageProps({ src: Accessibility, ...props });
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.

logic: destructuring could fail if getImageProps doesn't return expected shape - consider adding error handling

Comment on lines +19 to +26
loaders: async () => {
cookies().set('firstName', 'Jane');
cookies().set({
name: 'lastName',
value: 'Doe',
});
headers().set('timezone', 'Central European Summer Time');
},
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.

logic: The loader function doesn't return anything - should return an empty object to match Storybook loader API

Comment on lines +31 to +34
await step('Cookie and header store apis are called upon rendering', async () => {
await expect(cookiesMock.getAll).toHaveBeenCalled();
await expect(headersMock.entries).toHaveBeenCalled();
});
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.

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 }) => {
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.

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');
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.

style: No error handling for failed cookie operations. Consider wrapping in try/catch.

Comment on lines +33 to +35
<form action={handleClick}>
<button>add user-id cookie</button>
</form>
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.

style: Button lacks aria-label and descriptive text for accessibility


import { redirect } from 'next/navigation';

let state = 'Bug! Not invalidated';
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.

logic: Using a global variable for state management could cause issues in concurrent rendering and test isolation

Comment on lines +16 to +19
action={() => {
state = 'State is invalidated successfully.';
redirect('/');
}}
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.

logic: Form action should be marked with 'use server' directive for Next.js server actions

@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: fa533f1, ran on 12 November 2024 at 13:24:46 UTC

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

@storybook/addon-mdx-gfm

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

@yannbf yannbf added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Nov 12, 2024
@yannbf yannbf merged commit 22df58c into next Nov 12, 2024
@yannbf yannbf deleted the yann/fix-next-13-sandboxes-again branch November 12, 2024 13:45
yannbf added a commit that referenced this pull request Nov 12, 2024
…-again

Build: Move more stories out of next 13 sandbox
(cherry picked from commit 22df58c)
yannbf added a commit that referenced this pull request Nov 13, 2024
…-again

Build: Move more stories out of next 13 sandbox
(cherry picked from commit 22df58c)
@github-actions github-actions Bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Nov 13, 2024
@ndelangen ndelangen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:daily Run the CI jobs that normally run in the daily job. patch:done Patch/release PRs already cherry-picked to main/release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants