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

Resource in useListController #5648

Closed
Al0ngsy opened this issue Dec 9, 2020 · 1 comment · Fixed by #5863
Closed

Resource in useListController #5648

Al0ngsy opened this issue Dec 9, 2020 · 1 comment · Fixed by #5863
Assignees
Labels

Comments

@Al0ngsy
Copy link

Al0ngsy commented Dec 9, 2020

const resource = useResourceContext(props);

Shouldn't this line be const resource = res || useResourceContext(props); with const {resource: res, ...otherProps} = props instead? Since on line 109 there is still a check for 'resource' as a required props in ListControllerProps.

useCheckMinimumRequiredProps('List', ['basePath', 'resource'], props);

My Problem: I tried to render resource Y inside a Modal when I am currently at resource X and this one breaks the ListView since it returns data from X instead of Y. It works fine on v3.8 but breaks after updated to v3.10.

@djhi
Copy link
Collaborator

djhi commented Dec 9, 2020

Actually, the resource should be removed from the useCheckMinimumRequiredProps. Indeed the reason we pass the props the useResourceContext is to fallback to the resource prop until we release version 4. Would you mind opening a pr to fix it ?

As for your usecase, you may pass the resource prop for now but will probably need to wrap your List with a ResourceContextProvider later

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

Successfully merging a pull request may close this issue.

3 participants