-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add support for react-admin v5 #572
Conversation
}; | ||
/* eslint-enable tree-shaking/no-side-effects-in-initialization */ | ||
|
||
const AdminGuesserWithError = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer need this wrapper as react-admin v5 has a global error boundary
src/AdminResourcesGuesser.tsx
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component extracted to its own file for clarity
@@ -202,51 +121,4 @@ const AdminGuesser = ({ | |||
); | |||
}; | |||
|
|||
/* eslint-disable tree-shaking/no-side-effects-in-initialization */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react-admin v5 no longer has propTypes, React 18.3 warns against them, so I removed them
* If child components are passed (usually `<ResourceGuesser>` or `<Resource>` components, but it can be any other React component), they are rendered in the given order. | ||
* If no children are passed, a `<ResourceGuesser>` component is created for each resource type exposed by the API, in the order they are specified in the API documentation. | ||
*/ | ||
export const AdminResourcesGuesser = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted to its own file for clarity
SchemaAnalyzer, | ||
} from './types.js'; | ||
|
||
const ResourcesIntrospecter = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to its own file for clarity
I'm blocked. For a reason I don't understand, the jest tests fail at reading the I've verified that:
If someone wants to give it a try, be my guest. That being said, the storybook runs the test admin with greetings, so we're probably close. |
const embeddedsField = await screen.findByLabelText( | ||
'resources.users.fields.embeddeds', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is due to a change in RA v5: ArrayInputs with scalar value no longer have a label of the form resources.users.fields.embeddeds.0
. The recommendation is now to provide your own label (which I did).
'^@tanstack/react-query$': | ||
'<rootDir>/node_modules/@tanstack/react-query/build/modern/index.cjs', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, Jest resolved imports to @tanstack/react-query
to the ESM code when imported from the test file, and to the CJS code when imported from ra-core
. This caused the issue about QueryClient
because the references to the context object were not equal.
This line forces the resolution to the CJS code all the time, which solves the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a problem react-admin users may be facing, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it could be, if they are using Jest with NODE_OPTIONS=--experimental-vm-modules
. But I'm not sure it's react-admin's responsibility to document this, as this rather looks like a Jest bug to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to core
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@api-platform/admin", | |||
"version": "3.4.8", | |||
"version": "4.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To revert, this will be handled by yarn version
during the release process: https://github.com/api-platform/admin/blob/main/CONTRIBUTING.md#tag-a-new-version-contributors-only
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
Great! Can someone with NPM credentials trigger the publication of the package? |
Closes #569