Skip to content

Commit

Permalink
Filter nullable fields in fetchRelatedRecords
Browse files Browse the repository at this point in the history
  • Loading branch information
Luwangel committed Sep 25, 2018
1 parent e3cada5 commit 868e034
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/ra-ui-materialui/src/button/ExportButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ const sanitizeRestProps = ({
*/
const fetchRelatedRecords = dispatch => (data, field, resource) =>
new Promise((resolve, reject) => {
const sanitizedData = data
.filter(record => record[field])
.map(record => record[field]);

// find unique keys
const ids = [...new Set(data.map(record => record[field]))];
const ids = [...new Set(sanitizedData)];

dispatch({
type: CRUD_GET_MANY,
payload: { ids },
Expand Down

0 comments on commit 868e034

Please sign in to comment.