diff --git a/packages/ra-data-graphcool/src/buildVariables.js b/packages/ra-data-graphcool/src/buildVariables.js index d9dc92d2e4f..04950cf2026 100644 --- a/packages/ra-data-graphcool/src/buildVariables.js +++ b/packages/ra-data-graphcool/src/buildVariables.js @@ -29,8 +29,8 @@ const buildGetListVariables = introspectionResults => ( if (filterSome) { const filter = Object.keys(params.filter[key]).reduce( - (acc, k) => ({ - ...acc, + (filter_acc, k) => ({ + ...filter_acc, [`${k}_in`]: params.filter[key][k], }), {} @@ -85,7 +85,7 @@ const buildGetListVariables = introspectionResults => ( }; }; -const buildCreateUpdateVariables = () => ( +const buildCreateUpdateVariables = ( resource, aorFetchType, params, @@ -147,28 +147,18 @@ export default introspectionResults => ( }; } case GET_ONE: + case DELETE: return { id: params.id, }; + case CREATE: case UPDATE: { - return buildCreateUpdateVariables(introspectionResults)( - resource, - aorFetchType, - params, - queryType - ); - } - case CREATE: { - return buildCreateUpdateVariables(introspectionResults)( + return buildCreateUpdateVariables( resource, aorFetchType, params, queryType ); } - case DELETE: - return { - id: params.id, - }; } }; diff --git a/packages/ra-data-graphql-simple/src/buildVariables.js b/packages/ra-data-graphql-simple/src/buildVariables.js index c88280e62c2..f542e54e7ec 100644 --- a/packages/ra-data-graphql-simple/src/buildVariables.js +++ b/packages/ra-data-graphql-simple/src/buildVariables.js @@ -89,7 +89,7 @@ const prepareParams = (params, queryType, introspectionResults) => { return; } - result[key] = castType(param, arg.type, introspectionResults.types); + result[key] = castType(param, arg.type); }); return result; @@ -115,8 +115,8 @@ const buildGetListVariables = introspectionResults => ( if (filterSome) { const filter = Object.keys(params.filter[key]).reduce( - (acc, k) => ({ - ...acc, + (filter_acc, k) => ({ + ...filter_acc, [`${k}_in`]: params.filter[key][k], }), {} @@ -185,7 +185,7 @@ const buildGetListVariables = introspectionResults => ( }; }; -const buildCreateUpdateVariables = () => ( +const buildCreateUpdateVariables = ( resource, aorFetchType, params, @@ -256,28 +256,18 @@ export default introspectionResults => ( }; } case GET_ONE: + case DELETE: return { id: preparedParams.id, }; + case CREATE: case UPDATE: { - return buildCreateUpdateVariables(introspectionResults)( - resource, - aorFetchType, - preparedParams, - queryType - ); - } - case CREATE: { - return buildCreateUpdateVariables(introspectionResults)( + return buildCreateUpdateVariables( resource, aorFetchType, preparedParams, queryType ); } - case DELETE: - return { - id: preparedParams.id, - }; } }; diff --git a/packages/ra-tree-core/src/getTreeFromArray.js b/packages/ra-tree-core/src/getTreeFromArray.js index 505712dab20..55dca64ecb6 100644 --- a/packages/ra-tree-core/src/getTreeFromArray.js +++ b/packages/ra-tree-core/src/getTreeFromArray.js @@ -32,6 +32,6 @@ export default (data, parentSource) => { id: 'id', parentId: parentSource, }) - .map(node => createNode(node, 1)) + .map(node => createNode(node)) .map(node => addParent(node, null)); }; diff --git a/packages/ra-ui-materialui/src/form/SimpleForm.js b/packages/ra-ui-materialui/src/form/SimpleForm.js index a1df694665d..a216e38c311 100644 --- a/packages/ra-ui-materialui/src/form/SimpleForm.js +++ b/packages/ra-ui-materialui/src/form/SimpleForm.js @@ -33,7 +33,9 @@ const SimpleForm = ({ initialValues, defaultValue, saving, ...props }) => { const submit = values => { const finalRedirect = - typeof redirect === undefined ? props.redirect : redirect.current; + typeof redirect.current === undefined + ? props.redirect + : redirect.current; const finalValues = sanitizeEmptyValues(finalInitialValues, values); props.save(finalValues, finalRedirect); diff --git a/packages/ra-ui-materialui/src/form/TabbedForm.js b/packages/ra-ui-materialui/src/form/TabbedForm.js index 3663582b4d8..43a70d9345a 100644 --- a/packages/ra-ui-materialui/src/form/TabbedForm.js +++ b/packages/ra-ui-materialui/src/form/TabbedForm.js @@ -47,7 +47,9 @@ const TabbedForm = ({ initialValues, defaultValue, saving, ...props }) => { const submit = values => { const finalRedirect = - typeof redirect === undefined ? props.redirect : redirect.current; + typeof redirect.current === undefined + ? props.redirect + : redirect.current; const finalValues = sanitizeEmptyValues(finalInitialValues, values); props.save(finalValues, finalRedirect); diff --git a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx index 8cbdd20908a..9e0ea023cc5 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx @@ -23,8 +23,6 @@ import InputHelperText from './InputHelperText'; import AutocompleteSuggestionList from './AutocompleteSuggestionList'; import AutocompleteSuggestionItem from './AutocompleteSuggestionItem'; -interface Props {} - interface Options { suggestionsContainerProps?: any; labelProps?: any; @@ -93,7 +91,7 @@ interface Options { * */ const AutocompleteArrayInput: FunctionComponent< - Props & InputProps & DownshiftProps + InputProps & DownshiftProps > = ({ allowEmpty, classes: classesOverride, diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx index 8d891096a99..eb25917235d 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx @@ -23,8 +23,6 @@ import InputHelperText from './InputHelperText'; import AutocompleteSuggestionList from './AutocompleteSuggestionList'; import AutocompleteSuggestionItem from './AutocompleteSuggestionItem'; -interface Props {} - interface Options { suggestionsContainerProps?: any; labelProps?: any; @@ -93,7 +91,7 @@ interface Options { * */ const AutocompleteInput: FunctionComponent< - Props & InputProps & DownshiftProps + InputProps & DownshiftProps > = ({ allowEmpty, classes: classesOverride,