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

[v5 b0] Incorrect dependency setting of of react-error-boundary in ra-core #9872

Closed
smeng9 opened this issue May 23, 2024 · 2 comments
Closed
Labels

Comments

@smeng9
Copy link
Contributor

smeng9 commented May 23, 2024

What you were expecting:

I expect there would be no errors when upgrading from v5 alpha to v5 beta

What happened instead:

Seems the dependency of react-error-boundary is not configured correctly in ra-core
It's missing in the package.json of ra-core

Steps to reproduce:

A regression is introduced in #9799

Related code:

The react-error-boundary package is used in both ra-core and ra-ui-materialui since 5.0.0-beta.0

To fix the issue:
This react-error-boundary package probably should be listed as peer and dev dependencies of ra-core and ra-ui-materialui and listed as dependencies of react-admin. Main reason is we don't want duplicate instances of react-error-boundary package when we install react-admin as it may break the context singleton.

Other information:

Environment

Note: I suggest adding these two fields below to the issue template to help gather more debugging information
Package manager: Yarn PnP
Bundler: vite

  • React-admin version: 5.0.0-beta.0
  • Last version that did not exhibit the issue (if applicable): 5.0.0-alpha-0
  • React version: 18.3
  • Browser: Safari
  • Stack trace (in case of a JS error):
    Error: ra-core tried to access react-error-boundary, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
    Required package: react-error-boundary
    Required by: ra-core@virtual:57ec434b280cecc21f0d850993a2b40d7d7207392bbeca8dfeb365d37d5e155154e25e45acd205ce4a7bdcebf37261127fea25b17cc30a453cf436af297bfcfb#npm:5.0.0-beta.0 (via /builder/f1c83f7c_6908322106/.yarn/virtual/ra-core-virtual-cf17e9d32a/3/root/.yarn/berry/cache/ra-core-npm-5.0.0-beta.0-4ab55eff7b-10c0.zip/node_modules/ra-core/dist/cjs/core/)
    Require stack:
  • /builder/f1c83f7c_6908322106/.yarn/virtual/ra-core-virtual-cf17e9d32a/3/root/.yarn/berry/cache/ra-core-npm-5.0.0-beta.0-4ab55eff7b-10c0.zip/node_modules/ra-core/dist/cjs/core/CoreAdminUI.js
    ❯ Function.require$$0.Module._resolveFilename .pnp.cjs:16996:13
    ❯ Function.require$$0.Module._load .pnp.cjs:16887:31
    ❯ Object. .yarn/virtual/ra-core-virtual-cf17e9d32a/3/root/.yarn/berry/cache/ra-core-npm-5.0.0-beta.0-4ab55eff7b-10c0.zip/node_modules/ra-core/src/core/CoreAdminUI.tsx:12:1
    ❯ Object.require$$0.Module._extensions..js .pnp.cjs:17039:33
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
    Serialized Error: { code: 'MODULE_NOT_FOUND', pnpCode: 'UNDECLARED_DEPENDENCY', data: { request: 'react-error-boundary', issuer: '/builder/f1c83f7c_6908322106/.yarn/virtual/ra-core-virtual-cf17e9d32a/3/root/.yarn/berry/cache/ra-core-npm-5.0.0-beta.0-4ab55eff7b-10c0.zip/node_modules/ra-core/dist/cjs/core/', issuerLocator: { name: 'ra-core', reference: 'virtual:57ec434b280cecc21f0d850993a2b40d7d7207392bbeca8dfeb365d37d5e155154e25e45acd205ce4a7bdcebf37261127fea25b17cc30a453cf436af297bfcfb#npm:5.0.0-beta.0' }, dependencyName: 'react-error-boundary' }, requireStack: [ '/builder/f1c83f7c_6908322106/.yarn/virtual/ra-core-virtual-cf17e9d32a/3/root/.yarn/berry/cache/ra-core-npm-5.0.0-beta.0-4ab55eff7b-10c0.zip/node_modules/ra-core/dist/cjs/core/CoreAdminUI.js' ] }
@djhi
Copy link
Collaborator

djhi commented May 23, 2024

Thanks for the report!

@fzaninotto
Copy link
Member

Fixed by #9873

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

No branches or pull requests

3 participants