-
-
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
Use resource definition to set default <Datagrid rowClick>
value
#9466
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ import { | |
useListContext, | ||
useResourceContext, | ||
RaRecord, | ||
useResourceDefinition, | ||
} from 'ra-core'; | ||
|
||
import { ListProps } from './List'; | ||
|
@@ -74,7 +73,6 @@ const ListViewGuesser = ( | |
) => { | ||
const { data } = useListContext(props); | ||
const resource = useResourceContext(); | ||
const { hasEdit, hasShow } = useResourceDefinition(props); | ||
const [child, setChild] = useState(null); | ||
const { | ||
enableLog = process.env.NODE_ENV === 'development', | ||
|
@@ -93,7 +91,7 @@ const ListViewGuesser = ( | |
); | ||
const inferredChild = new InferredElement( | ||
listFieldTypes.table, | ||
{ hasEdit, hasShow }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it's no longer necessary 🤷 |
||
null, | ||
inferredElements | ||
); | ||
setChild(inferredChild.getElement()); | ||
|
@@ -128,7 +126,7 @@ ${inferredChild.getRepresentation()} | |
);` | ||
); | ||
} | ||
}, [data, child, resource, hasEdit, hasShow, enableLog]); | ||
}, [data, child, resource, enableLog]); | ||
|
||
return <ListView {...rest}>{child}</ListView>; | ||
}; | ||
|
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.
Not for this PR but this should probably be automatic as well (detection of the available views with the same priorities)