-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Introduce Resource Context #5456
Conversation
const controllerProps = useReferenceArrayFieldController({ | ||
resource, |
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.
why doesn't the useReferenceArrayFieldController call the useResourceContext itself?
const controllerProps = useReferenceManyFieldController({ | ||
page, | ||
perPage, | ||
resource, |
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.
same
return children(useReferenceInputController(props)) as ReactElement; | ||
const { resource } = useResourceContext(props); | ||
return children( | ||
useReferenceInputController({ resource, ...props }) |
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.
same
@@ -23,6 +23,7 @@ import { | |||
Record, | |||
Exporter, | |||
} from '../types'; | |||
import { useResourceContext, useResourceDefinition } from '../core'; |
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.
no longer necessary
* Must be used within a <ResourceContextProvider> (e.g. as a descendent of <Resource> | ||
* or any reference related components). | ||
* | ||
* @returns {ResourceContextValue} The resource informations |
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.
* @returns {ResourceContextValue} The resource informations | |
* @returns {ResourceContextValue} The resource information |
import { ResourceContext, ResourceContextValue } from './ResourceContext'; | ||
|
||
/** | ||
* Hook to read the resource informations from the ResourceContext. |
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.
* Hook to read the resource informations from the ResourceContext. | |
* Hook to read the resource information from the ResourceContext. |
redirect = 'list', | ||
onSuccess, | ||
onFailure, | ||
...rest | ||
} = props; | ||
const translate = useTranslate(); | ||
const classes = useStyles(props); | ||
const { resource } = useResourceContext(props); |
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.
same
@@ -31,6 +31,7 @@ const DeleteWithUndoButton: FC<DeleteWithUndoButtonProps> = props => { | |||
...rest | |||
} = props; | |||
const classes = useStyles(props); | |||
const { resource } = useResourceContext(props); |
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.
same
ce33ab8
to
99f79a0
Compare
\o/ |
Supersedes #5446