Update react-query
This commit is contained in:
parent
bb49f6e151
commit
6756db1013
9 changed files with 35 additions and 34 deletions
|
@ -1,9 +1,9 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import { ReactQueryCacheProvider } from 'react-query';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import ComboSearch from './ComboSearch';
|
||||
import { queryCache } from './shared/queryCache';
|
||||
import { queryClient } from './shared/queryClient';
|
||||
|
||||
function ComboAdresseSearch({
|
||||
mandatory,
|
||||
|
@ -16,7 +16,7 @@ function ComboAdresseSearch({
|
|||
const transformResults = useCallback((_, { features }) => features);
|
||||
|
||||
return (
|
||||
<ReactQueryCacheProvider queryCache={queryCache}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ComboSearch
|
||||
placeholder={placeholder}
|
||||
required={mandatory}
|
||||
|
@ -28,7 +28,7 @@ function ComboAdresseSearch({
|
|||
transformResult={transformResult}
|
||||
transformResults={transformResults}
|
||||
/>
|
||||
</ReactQueryCacheProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import { ReactQueryCacheProvider } from 'react-query';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
|
||||
import ComboSearch from './ComboSearch';
|
||||
import { queryCache } from './shared/queryCache';
|
||||
import { queryClient } from './shared/queryClient';
|
||||
|
||||
function ComboAnnuaireEducationSearch(params) {
|
||||
return (
|
||||
<ReactQueryCacheProvider queryCache={queryCache}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ComboSearch
|
||||
required={params.mandatory}
|
||||
hiddenFieldId={params.hiddenFieldId}
|
||||
|
@ -21,7 +21,7 @@ function ComboAnnuaireEducationSearch(params) {
|
|||
}
|
||||
}) => [id, `${nom_etablissement}, ${nom_commune} (${id})`]}
|
||||
/>
|
||||
</ReactQueryCacheProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import { ReactQueryCacheProvider } from 'react-query';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
|
||||
import ComboSearch from './ComboSearch';
|
||||
import { queryCache } from './shared/queryCache';
|
||||
import { queryClient } from './shared/queryClient';
|
||||
|
||||
function ComboCommunesSearch(params) {
|
||||
return (
|
||||
<ReactQueryCacheProvider queryCache={queryCache}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ComboSearch
|
||||
required={params.mandatory}
|
||||
hiddenFieldId={params.hiddenFieldId}
|
||||
|
@ -17,7 +17,7 @@ function ComboCommunesSearch(params) {
|
|||
`${nom} (${codesPostaux[0]})`
|
||||
]}
|
||||
/>
|
||||
</ReactQueryCacheProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import { ReactQueryCacheProvider } from 'react-query';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
import { matchSorter } from 'match-sorter';
|
||||
|
||||
import ComboSearch from './ComboSearch';
|
||||
import { queryCache } from './shared/queryCache';
|
||||
import { queryClient } from './shared/queryClient';
|
||||
|
||||
const extraTerms = [{ code: '99', nom: 'Etranger' }];
|
||||
|
||||
|
@ -16,7 +16,7 @@ function ComboDepartementsSearch(params) {
|
|||
]);
|
||||
|
||||
return (
|
||||
<ReactQueryCacheProvider queryCache={queryCache}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ComboSearch
|
||||
required={params.mandatory}
|
||||
hiddenFieldId={params.hiddenFieldId}
|
||||
|
@ -25,7 +25,7 @@ function ComboDepartementsSearch(params) {
|
|||
transformResult={({ code, nom }) => [code, `${code} - ${nom}`]}
|
||||
transformResults={transformResults}
|
||||
/>
|
||||
</ReactQueryCacheProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import { ReactQueryCacheProvider } from 'react-query';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
|
||||
import ComboSearch from './ComboSearch';
|
||||
import { queryCache } from './shared/queryCache';
|
||||
import { queryClient } from './shared/queryClient';
|
||||
|
||||
function ComboPaysSearch(params) {
|
||||
return (
|
||||
<ReactQueryCacheProvider queryCache={queryCache}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ComboSearch
|
||||
required={params.mandatory}
|
||||
hiddenFieldId={params.hiddenFieldId}
|
||||
|
@ -14,7 +14,7 @@ function ComboPaysSearch(params) {
|
|||
minimumInputLength={0}
|
||||
transformResult={({ nom }) => [nom, nom]}
|
||||
/>
|
||||
</ReactQueryCacheProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import { ReactQueryCacheProvider } from 'react-query';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
|
||||
import ComboSearch from './ComboSearch';
|
||||
import { queryCache } from './shared/queryCache';
|
||||
import { queryClient } from './shared/queryClient';
|
||||
|
||||
function ComboRegionsSearch(params) {
|
||||
return (
|
||||
<ReactQueryCacheProvider queryCache={queryCache}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ComboSearch
|
||||
required={params.mandatory}
|
||||
hiddenFieldId={params.hiddenFieldId}
|
||||
|
@ -14,7 +14,7 @@ function ComboRegionsSearch(params) {
|
|||
minimumInputLength={0}
|
||||
transformResult={({ code, nom }) => [code, nom]}
|
||||
/>
|
||||
</ReactQueryCacheProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { QueryCache } from 'react-query';
|
||||
import { QueryClient } from 'react-query';
|
||||
import { isNumeric } from '@utils';
|
||||
import { matchSorter } from 'match-sorter';
|
||||
|
||||
const { api_geo_url, api_adresse_url, api_education_url } =
|
||||
gon.autocomplete || {};
|
||||
|
||||
export const queryCache = new QueryCache({
|
||||
defaultConfig: {
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
queryFn: defaultQueryFn
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ function buildOptions() {
|
|||
return [{}, null];
|
||||
}
|
||||
|
||||
async function defaultQueryFn(scope, term) {
|
||||
async function defaultQueryFn({ queryKey: [scope, term] }) {
|
||||
if (scope == 'pays') {
|
||||
return matchSorter(await getPays(), term, { keys: ['nom'] });
|
||||
}
|
|
@ -30,7 +30,7 @@
|
|||
"react-intersection-observer": "^8.31.0",
|
||||
"react-mapbox-gl": "^4.8.6",
|
||||
"react-mapbox-gl-draw": "^2.0.4",
|
||||
"react-query": "^2.23.1",
|
||||
"react-query": "^3.9.7",
|
||||
"react-sortable-hoc": "^1.11.0",
|
||||
"react_ujs": "^2.6.1",
|
||||
"select2": "^4.0.13",
|
||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -8030,7 +8030,7 @@ marked@^0.3.6:
|
|||
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790"
|
||||
integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==
|
||||
|
||||
match-sorter@^6.2.0:
|
||||
match-sorter@^6.0.2, match-sorter@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/match-sorter/-/match-sorter-6.2.0.tgz#e3f29d4733ef835a0baccc7b9d291c07264985e8"
|
||||
integrity sha512-yhmUTR5q6JP/ssR1L1y083Wp+C+TdR8LhYTxWI4IRgEUr8IXJu2mE6L3SwryCgX95/5J7qZdEg0G091sOxr1FQ==
|
||||
|
@ -10612,12 +10612,13 @@ react-mapbox-gl@^4.8.6:
|
|||
deep-equal "1.0.1"
|
||||
supercluster "^7.0.0"
|
||||
|
||||
react-query@^2.23.1:
|
||||
version "2.23.1"
|
||||
resolved "https://registry.yarnpkg.com/react-query/-/react-query-2.23.1.tgz#7d676f56d3c6e96b4de4d0b178baf6bb6a0ec272"
|
||||
integrity sha512-qIma0Kvr//LWgWFah7RcntvD4FurXXdQaQeIfqhCWKdhihhe3Xs5BHsljAP68jo719/+xhWxL3I96SvrU4gGHA==
|
||||
react-query@^3.9.7:
|
||||
version "3.9.7"
|
||||
resolved "https://registry.yarnpkg.com/react-query/-/react-query-3.9.7.tgz#324c697f418827c129c8c126d233c6052bb1e35e"
|
||||
integrity sha512-vpQgRFOljd7Lr1wL8hOwxWzb7awLIjaeqaq6DJ1fzA8N9mK1fAkK+UVrt8WaXJGBfz7JEnfCiXuENQspk0N7Sw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.5.5"
|
||||
match-sorter "^6.0.2"
|
||||
|
||||
react-sortable-hoc@^1.11.0:
|
||||
version "1.11.0"
|
||||
|
|
Loading…
Reference in a new issue