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

Failed React 18 upgrade via nx migrate 13.10 #9734

Closed
jasongerbes opened this issue Apr 7, 2022 · 6 comments · Fixed by #9811
Closed

Failed React 18 upgrade via nx migrate 13.10 #9734

jasongerbes opened this issue Apr 7, 2022 · 6 comments · Fixed by #9811
Assignees
Labels
outdated scope: react Issues related to React support for Nx type: bug

Comments

@jasongerbes
Copy link
Contributor

jasongerbes commented Apr 7, 2022

Current Behavior

When running the 13.10 migration, the following changes are made to my package.json:

  • devDependencies
    • Upgraded @types/react to 17.0.43
    • Upgraded @types/react-dom to 17.0.14
  • dependencies
    • Added react-is version 18.0.0
    • Added react-test-renderer version 18.0.0

Note: This migration results in two versions of react-test-renderer: v17 as a dev dependency, and v18 as an actual dependency.

Expected Behavior

Per the 13.10 release notes, nx migrate 13.10 should upgrade to React 18.

I would expect the following package.json changes to be made:

  • devDependencies
    • Upgrade @types/react to 18.0.0
    • Upgrade @types/react-dom to 18.0.0
    • Upgrade react-test-renderer to 18.0.0
  • dependencies
    • Add react-is version 18.0.0
    • Upgrade react to version 18.0.0
    • Upgrade react-dom to version 18.0.0

Steps to Reproduce

  1. Start with a <= 13.9 Nx workstation with react libraries/apps.
  2. Run nx migrate latest
  3. Run npm i
  4. Run nx migrate --run-migrations
  5. Check changes to root package.json

Environment

Node : 16.14.2
OS   : darwin x64
npm  : 8.5.0

nx : 13.10.0
@nrwl/angular : Not Found
@nrwl/cypress : 13.10.0
@nrwl/detox : Not Found
@nrwl/devkit : 13.10.0
@nrwl/eslint-plugin-nx : 13.10.0
@nrwl/express : Not Found
@nrwl/jest : 13.10.0
@nrwl/js : 13.10.0
@nrwl/linter : 13.10.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : 13.2.2
@nrwl/nx-plugin : Not Found
@nrwl/react : 13.10.0
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 13.10.0
@nrwl/web : 13.10.0
@nrwl/workspace : 13.10.0
typescript : 4.5.5
rxjs : 6.6.7
---------------------------------------
Community plugins:
@jasongerbes
Copy link
Contributor Author

Also, for reference, here is my migrations.json file:

{
  "migrations": [
    {
      "version": "13.10.0-beta.0",
      "description": "Update the decorate-angular-cli script to require nx instead of @nrwl/cli",
      "cli": "nx",
      "implementation": "./src/migrations/update-13-10-0/update-decorate-cli",
      "package": "@nrwl/workspace",
      "name": "13-10-0-update-decorate-cli"
    },
    {
      "version": "13.10.0-beta.0",
      "description": "Update the tasks runner property to import it from the nx package instead of @nrwl/worksapce",
      "cli": "nx",
      "implementation": "./src/migrations/update-13-10-0/update-tasks-runner",
      "package": "@nrwl/workspace",
      "name": "13-10-0-update-tasks-runner"
    },
    {
      "cli": "nx",
      "version": "13.10.0-beta.0",
      "description": "Update to React 18",
      "factory": "./src/migrations/update-13-10-0/update-13-10-0",
      "package": "@nrwl/react",
      "name": "update-react-18-13.10.0"
    }
  ]
}

@AgentEnder AgentEnder added the scope: react Issues related to React support for Nx label Apr 12, 2022
@jaysoo
Copy link
Member

jaysoo commented Apr 12, 2022

Types are updated here #9811, and test renderer fix is here #9767.

@gt-vh-1985
Copy link

When this fix will get released? Any specific version we can lookout for?

@jaysoo
Copy link
Member

jaysoo commented Apr 13, 2022

We'll release a patch soon for 13.10.2.

Workaround for now is to manually update your packages for @types/react, @types/react-dom, react-test-renderer.

@MichaelDeBoey
Copy link
Contributor

MichaelDeBoey commented Apr 21, 2022

@jaysoo #9613 is not updating the react, react-dom & react-test-renderer version, it's only adding react-is@18.0.0 in my package.json

This is caused by the fact that it's using the addDependenciesToPackageJson function, which is literally only adding dependencies, not updating them.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants