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

Unexpected ra-core upgrade #6346

Closed
danjebs opened this issue Jun 10, 2021 · 5 comments
Closed

Unexpected ra-core upgrade #6346

danjebs opened this issue Jun 10, 2021 · 5 comments

Comments

@danjebs
Copy link

danjebs commented Jun 10, 2021

I opened up React-Admin on my dev rig and got the error below:

./node_modules/ra-ui-materialui/esm/layout/Menu.js
Attempted import error: 'useGetResourceLabel' is not exported from 'ra-core'.

My package.json is:

{
  ...
  },
  "dependencies": {
    "@apollo/client": "^3.0.2",
    "@ckeditor/ckeditor5-react": "^3.0.0",
    "@rails/activestorage": "^6.0.3-2",
    "graphql": "^15.3.0",
    "lodash": "^4.17.16",
    "next": "10.0.1",
    "query-string": "^6.13.1",
    "ra-core": "3.15.1",
    "ra-data-graphql": "3.11.4",
    "ra-data-graphql-simple": "3.13.2",
    "ra-data-json-server": "3.15.1",
    "react": "^16.13.1",
    "react-admin": "3.15.1",
    "react-beautiful-dnd": "^13.0.0",
    "react-dom": "^16.13.1",
    "react-media-recorder": "^1.4.0",
    "trix": "^1.2.4",
    "util": "^0.12.3"
  }
}

Upgrading to 3.16.0 fixed the issue. But I think we shouldn't have these kind of upstream updates. And I was under the impression that fixing issue #5979 would resolve these kinds of unexpected package bumps.

Is there something I am missing?

@andrei9669
Copy link
Contributor

My question is that why are you importing it from ra-core instead of react-admin?
Thing is that in my setup, I don't even have ra-core as my dependency since I would be getting tons of TS errors if I ever import from there.

@fzaninotto
Copy link
Member

I cannot reproduce the issue, please include a link to a codesandbox/repository showing the problem.

@danjebs
Copy link
Author

danjebs commented Aug 9, 2021

@andrei9669 the ra-core import was added for the setup of a custom ra-data-graphql dataProvider. It's possible that this is unnecessary, I hacked my way through the initial setup. In this case the ra-core package was just used for importing query type constants, eg

import { GET_ONE, UPDATE, DELETE, DELETE_MANY, UPDATE_MANY } from 'ra-core'

I'll try removing that dependency and maybe even switch over to ra-data-graphql-simple and see if that improves things.

@fzaninotto
Copy link
Member

So you probably have a dependency on another version of ra-core than the react-admin package, causing npm to add ra-core twice. React contexts don't work well when there are two instances of a library, and this would likely cause the problem you're seeing.

Anyway, as the problem seems to be in your code and not react-admin's, I'm closing this issue. Feel free to reopen if you can reduce it to a react-admin bug.

@danjebs
Copy link
Author

danjebs commented Aug 9, 2021

Actually I had react-admin and ra-core locked at 3.15.1 - but I will remove ra-core and see how it goes.

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

No branches or pull requests

3 participants