Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to React v19 and Storybook v8 #396

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

meissadia
Copy link
Contributor

@meissadia meissadia commented Jan 30, 2025

Closes #393

Keep up-to-date with the latest major React release. For compatibility, also requires upgrading to Storybook v8.

Changes

  • Upgrade to React v19
    • Run related migration scripts
      • npx react-codemod update-react-imports
      • npx codemod@latest react/19/migration-recipe (no changes)
      • npx types-react-codemod@latest preset-19 ./
        • import type { JSX } from 'react'; does address a TSC error, so those have been kept in place
  • Upgrade to Storybook v8 (required for React v19)
    • Migrate deprecated file formats
      • npx storybook@latest migrate mdx-to-csf --glob "src/**/*.stories.mdx"
      • npx storybook@latest migrate csf-2-to-3 --glob="**/*.stories.tsx" --parser=tsx
    • Upgrade Storybook: npx storybook@latest upgrade
      • [Required] Removed deprecated feature storyStoreV7
      • [Required] Upgrade to Vite v4+
      • Run code migrations
        • github-flavored-markdown-mdx (yes)
        • autodocsTrue (yes)
        • remove-argtypes-regex (yes)
          • Check for implicit spies: npx storybook migrate find-implicit-spies --glob="./src/**/*.stories.*" (None found)
          • Removed deprecated configuration setting: argTypesRegex
        • upgradeStorybookRelatedDependencies (yes)
        • react-docgen (yes)
        • visual-tests-addon (no)
        • autodocs-tags (yes)
    • Remove incompatible add-on: yarn remove display-element-css
    • Replace @storybook/jest with @storybook/test per guidance

How to test this PR

  • DSR unit tests all pass (yarn test)
  • SBL Frontend: Functional integration is successful (e2e tests all pass), confirming that our (used) components still operate as expected
  • SBL Frontend: Run snapshot tests to verify that DSR styles remain unchanged
    • sbl-frontend > yarn && yarn test:e2e:snapshot --headless
    • Snapshot tests look acceptable. No undesired changes found.

TODO

Potential blocker: Github actions failure -- Hanging process during yarn test:ci

Jan 30 - This seems to be an intermittent error because, right now, the tests are passing without the hanging process 🤷🏾‍♂️

Note: this seems to be a pre-existing issue not caused by these upgrades

  • git checkout main && git pull && yarn && yarn test:ci shows the same failure
close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters

Attempted workarounds:

  • yarn run vitest --reporter=hanging-process shows lots of the following, enough to overrun my terminal buffer, so I'm working to capture the full output for further evaluation
    # FILEHANDLE
    node:internal/async_hooks:202
    
  • Using Node v22 instead of v20 does not fix it
  • Upgrading vitest does not fix it
  • Running with different "pool" type does not fix: yarn run vitest run --pool=threads

Copy link

netlify bot commented Jan 30, 2025

Deploy Preview for cfpb-design-system-react ready!

Name Link
🔨 Latest commit 233ee50
🔍 Latest deploy log https://app.netlify.com/sites/cfpb-design-system-react/deploys/679be936e8a0620008ada8ac
😎 Deploy Preview https://deploy-preview-396--cfpb-design-system-react.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 site configuration.

@meissadia meissadia marked this pull request as ready for review January 31, 2025 00:03
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.

[Explore] Upgrade to React v19, Storybook v8
1 participant