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

Remove permissions prop injection from main views #6921

Merged
merged 5 commits into from
Dec 6, 2021

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Nov 30, 2021

No description provided.

@djhi djhi added the WIP Work In Progress label Nov 30, 2021
@djhi djhi mentioned this pull request Nov 30, 2021
@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels Dec 1, 2021
@djhi djhi added this to the 4.0.0-alpha.1 milestone Dec 1, 2021
@djhi djhi requested a review from fzaninotto December 1, 2021 09:04
};

export type UseAuthenticatedOptions<ParamsType> = {
enabled?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to have documentation of the new enabled prop

@@ -40,7 +40,7 @@ import useNotify from '../sideEffect/useNotify';
* return authenticated ? <Bar /> : <BarNotAuthenticated />;
* } // tip: use useAuthState() hook instead
*/
const useCheckAuth = (): CheckAuth => {
export const useCheckAuth = (): CheckAuth => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing export for type CheckAuth

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Resource component is becoming smaller and smaller... If we ever remove the registration phase, it'll just be routes!

@@ -28,9 +26,21 @@ const emptyParams = {};
* </Admin>
* );
*/
export default (params: any = emptyParams) => {
export const useAuthenticated = <ParamsType = any>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change for users who used to pass params, and should be mentioned in the upgrade guide

pathname: '/foo',
search: undefined,
state: undefined,
hash: undefined,
};

it('should return an empty record by default', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this one ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that's not the responsability of this function anymore

@@ -49,20 +51,23 @@ export const useCreateController = <
props: CreateControllerProps = {}
): CreateControllerResult<RecordType> => {
const {
record = {},
successMessage,
disableAuthentication,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should update the Auth doc to mention this prop. Same for other controllers.

docs/Authentication.md Outdated Show resolved Hide resolved
Co-authored-by: Aníbal Svarcas <[email protected]>
@vercel
Copy link

vercel bot commented Dec 6, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

react-admin – ./examples/simple

🔍 Inspect: https://vercel.com/marmelab/react-admin/Dr6KUPTzF9ajoCepS7Q8rfBk9RWR
✅ Preview: https://react-admin-git-remove-permissions-props-injection-marmelab.vercel.app

react-admin-storybook – ./

🔍 Inspect: https://vercel.com/marmelab/react-admin-storybook/CBquMNdhvCVpGTCMEHSUzHbXRZ33
✅ Preview: https://react-admin-storybook-git-remove-permissions-pr-6f1955-marmelab.vercel.app

docs/Authentication.md Outdated Show resolved Hide resolved
@fzaninotto fzaninotto merged commit ce3dceb into next Dec 6, 2021
@fzaninotto fzaninotto deleted the remove-permissions-props-injection branch December 6, 2021 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants