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