From a17110e4012ca7dc241ccba5d78f1bf09e78d9ab Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Mon, 18 Nov 2019 21:59:49 +0100 Subject: [PATCH 1/3] Fix setting filter resets pagination Closes #3703 Reverts #3716 --- packages/ra-core/package.json | 4 ++-- .../ra-core/src/controller/useListParams.ts | 9 +-------- packages/ra-ui-materialui/package.json | 4 ++-- packages/react-admin/package.json | 2 +- yarn.lock | 18 +++++++++--------- 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/packages/ra-core/package.json b/packages/ra-core/package.json index 4ac2cd40a65..f9d7a936fbe 100644 --- a/packages/ra-core/package.json +++ b/packages/ra-core/package.json @@ -43,7 +43,7 @@ "ignore-styles": "~5.0.1", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.0", + "react-final-form": "^6.3.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", "react-router-dom": "^5.1.0", @@ -57,7 +57,7 @@ "final-form": "^4.18.5", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.0", + "react-final-form": "^6.3.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", "react-router-dom": "^5.1.0", diff --git a/packages/ra-core/src/controller/useListParams.ts b/packages/ra-core/src/controller/useListParams.ts index d05f3cd78e9..3086fa63103 100644 --- a/packages/ra-core/src/controller/useListParams.ts +++ b/packages/ra-core/src/controller/useListParams.ts @@ -140,14 +140,7 @@ const useListParams = ({ ); const changeParams = useCallback(action => { - const newQuery = getQuery({ - location, - params, - filterDefaultValues, - sort, - perPage, - }); - const newParams = queryReducer(newQuery, action); + const newParams = queryReducer(query, action); history.push({ search: `?${stringify({ ...newParams, diff --git a/packages/ra-ui-materialui/package.json b/packages/ra-ui-materialui/package.json index 766268a211a..d571b8b0e5e 100644 --- a/packages/ra-ui-materialui/package.json +++ b/packages/ra-ui-materialui/package.json @@ -40,7 +40,7 @@ "ra-core": "^3.0.0-beta.6", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.0", + "react-final-form": "^6.3.1", "react-final-form-arrays": "^3.1.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", @@ -58,7 +58,7 @@ "ra-core": "^3.0.0-beta.2", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.0", + "react-final-form": "^6.3.1", "react-final-form-arrays": "^3.1.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", diff --git a/packages/react-admin/package.json b/packages/react-admin/package.json index f8fa3a0f6cc..e6d11a3f5ed 100644 --- a/packages/react-admin/package.json +++ b/packages/react-admin/package.json @@ -44,7 +44,7 @@ "ra-i18n-polyglot": "^3.0.0-beta.6", "ra-language-english": "^3.0.0-beta.2", "ra-ui-materialui": "^3.0.0-beta.6", - "react-final-form": "^6.3.0", + "react-final-form": "^6.3.1", "react-final-form-arrays": "^3.1.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", diff --git a/yarn.lock b/yarn.lock index 8737e654386..62469887647 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12682,13 +12682,13 @@ react-final-form-arrays@^3.1.1: dependencies: "@babel/runtime" "^7.4.5" -react-final-form@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/react-final-form/-/react-final-form-6.3.0.tgz#b85ae123a3796b3e0c8f56033c8a5037f4497e76" - integrity sha512-jijhXR1fFGUBQwNOSqF4MK8XJO7Ynl1p8vcFsnQS0INSkGI52+4IagjUgtHj3w8EviIHPFK/Eflji6FELUl07w== +react-final-form@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/react-final-form/-/react-final-form-6.3.1.tgz#d4b72a81892b2ebc46ea053d6b11b361d063ddf8" + integrity sha512-UzpAVBLnXRr2GnTP/Z3wjxlFZnfiOnWKNYW2ViK5+6Res0Ehp6vMkBLfaWaoHxSXNCUJtnItM23okAzBINSelg== dependencies: "@babel/runtime" "^7.4.5" - ts-essentials "^2.0.8" + ts-essentials "^3.0.2" react-is@^16.5.2, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: version "16.9.0" @@ -14830,10 +14830,10 @@ tryer@^1.0.1: resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== -ts-essentials@^2.0.8: - version "2.0.12" - resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-2.0.12.tgz#c9303f3d74f75fa7528c3d49b80e089ab09d8745" - integrity sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w== +ts-essentials@^3.0.2: + version "3.0.4" + resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-3.0.4.tgz#e783fc31ddce38e19429d2e7171d1c42654f3715" + integrity sha512-lVxvv4CzJURUagjsE3D2PwMK3yVZw0eGXWSlvXVI/cY5vICt5yQ/Cx9Row5fKRcy/rXXz1wzmmVHQtjJoL+lvg== ts-invariant@^0.4.0: version "0.4.4" From 338dcdb1e5959ad7b2a2381ba4a54541c5e9726a Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 19 Nov 2019 00:21:03 +0100 Subject: [PATCH 2/3] Fix types after react-final-form update --- packages/ra-core/src/form/FormField.tsx | 8 ++++++-- packages/ra-core/src/form/useInput.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/ra-core/src/form/FormField.tsx b/packages/ra-core/src/form/FormField.tsx index 47c1daa98a7..f424a8b17bc 100644 --- a/packages/ra-core/src/form/FormField.tsx +++ b/packages/ra-core/src/form/FormField.tsx @@ -1,6 +1,6 @@ import React, { FunctionComponent } from 'react'; import PropTypes from 'prop-types'; -import { Field, FieldProps } from 'react-final-form'; +import { Field, FieldProps, FieldRenderProps } from 'react-final-form'; import { Validator, composeValidators } from './validate'; export const isRequired = validate => { @@ -13,7 +13,11 @@ export const isRequired = validate => { return false; }; -interface Props extends Omit, 'validate'> { +interface Props + extends Omit< + FieldProps, HTMLElement>, + 'validate' + > { defaultValue?: any; input?: any; source: string; diff --git a/packages/ra-core/src/form/useInput.ts b/packages/ra-core/src/form/useInput.ts index d731498976c..309c4e6e0bd 100644 --- a/packages/ra-core/src/form/useInput.ts +++ b/packages/ra-core/src/form/useInput.ts @@ -1,6 +1,6 @@ import { useField as useFinalFormField, - FieldProps as FinalFormFieldProps, + FieldProps, FieldRenderProps, FieldInputProps, } from 'react-final-form'; @@ -10,7 +10,7 @@ import { useCallback, ChangeEvent } from 'react'; export interface InputProps extends Omit< - FinalFormFieldProps, + FieldProps, HTMLElement>, 'validate' | 'children' > { source: string; From 779ccb1b002f3641b1af6ccac71362e65e35994f Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 19 Nov 2019 14:52:27 +0100 Subject: [PATCH 3/3] Upgrade react-final-form again --- packages/ra-core/package.json | 4 ++-- packages/ra-ui-materialui/package.json | 4 ++-- packages/react-admin/package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/ra-core/package.json b/packages/ra-core/package.json index f9d7a936fbe..281d9c7d1b9 100644 --- a/packages/ra-core/package.json +++ b/packages/ra-core/package.json @@ -43,7 +43,7 @@ "ignore-styles": "~5.0.1", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.1", + "react-final-form": "^6.3.3", "react-redux": "^7.1.0", "react-router": "^5.1.0", "react-router-dom": "^5.1.0", @@ -57,7 +57,7 @@ "final-form": "^4.18.5", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.1", + "react-final-form": "^6.3.3", "react-redux": "^7.1.0", "react-router": "^5.1.0", "react-router-dom": "^5.1.0", diff --git a/packages/ra-ui-materialui/package.json b/packages/ra-ui-materialui/package.json index d571b8b0e5e..85a0e0b21bd 100644 --- a/packages/ra-ui-materialui/package.json +++ b/packages/ra-ui-materialui/package.json @@ -40,7 +40,7 @@ "ra-core": "^3.0.0-beta.6", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.1", + "react-final-form": "^6.3.3", "react-final-form-arrays": "^3.1.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", @@ -58,7 +58,7 @@ "ra-core": "^3.0.0-beta.2", "react": "^16.9.0", "react-dom": "^16.9.0", - "react-final-form": "^6.3.1", + "react-final-form": "^6.3.3", "react-final-form-arrays": "^3.1.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", diff --git a/packages/react-admin/package.json b/packages/react-admin/package.json index e6d11a3f5ed..f0fd9f54b75 100644 --- a/packages/react-admin/package.json +++ b/packages/react-admin/package.json @@ -44,7 +44,7 @@ "ra-i18n-polyglot": "^3.0.0-beta.6", "ra-language-english": "^3.0.0-beta.2", "ra-ui-materialui": "^3.0.0-beta.6", - "react-final-form": "^6.3.1", + "react-final-form": "^6.3.3", "react-final-form-arrays": "^3.1.1", "react-redux": "^7.1.0", "react-router": "^5.1.0", diff --git a/yarn.lock b/yarn.lock index 62469887647..64573ae1bb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12682,10 +12682,10 @@ react-final-form-arrays@^3.1.1: dependencies: "@babel/runtime" "^7.4.5" -react-final-form@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/react-final-form/-/react-final-form-6.3.1.tgz#d4b72a81892b2ebc46ea053d6b11b361d063ddf8" - integrity sha512-UzpAVBLnXRr2GnTP/Z3wjxlFZnfiOnWKNYW2ViK5+6Res0Ehp6vMkBLfaWaoHxSXNCUJtnItM23okAzBINSelg== +react-final-form@^6.3.3: + version "6.3.3" + resolved "https://registry.yarnpkg.com/react-final-form/-/react-final-form-6.3.3.tgz#8856a92278de2733f83e88c75d9ef347294a66a0" + integrity sha512-hFLwLpLasywky46SovNEGlym7+N+3RKge1/cg+/fVec/YY0l4g0ihgjRof6PbkiYe4qGjKbwbrvlgfZ9/Uf8vw== dependencies: "@babel/runtime" "^7.4.5" ts-essentials "^3.0.2"