@fto-consult/expo-ui 6.86.0 → 6.86.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.86.0",
3
+ "version": "6.86.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -166,6 +166,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
166
166
  const canHandleLimit = handleQueryLimit !== false && canHandlePagination ? true : false;
167
167
  const limitRef = React.useRef(!canHandleLimit ?0 : defaultNumber(getSessionData("limit"),500));
168
168
  const isInitializedRef = React.useRef(false);
169
+ const hasFetchedRef = React.useRef(false);
169
170
  testID = defaultStr(testID,"RNSWRDatagridComponent");
170
171
  const {error, isValidating,isLoading,data:result,refresh} = useSWR(fetchPath,{
171
172
  fetcher : (url,opts)=>{
@@ -193,10 +194,14 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
193
194
  if(showProgressRef.current ===false){
194
195
  opts.showError = false;
195
196
  }
197
+ const end = (a)=> {
198
+ hasFetchedRef.current = true;
199
+ return a;
200
+ };
196
201
  if(typeof fetcher =='function'){
197
- return fetcher(url,opts);
202
+ return Promise.resolve(fetcher(url,opts)).then(end);
198
203
  }
199
- return apiFetch(url,opts);
204
+ return apiFetch(url,opts).then(end);
200
205
  },
201
206
  swrOptions : getSWROptions(swrConfig.refreshTimeout)
202
207
  });
@@ -290,7 +295,9 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
290
295
  });
291
296
  });
292
297
  React.useEffect(()=>{
293
- showProgressRef.current = false;
298
+ if(hasFetchedRef.current){
299
+ showProgressRef.current = false;
300
+ }
294
301
  },[showProgressRef.current]);
295
302
  return (
296
303
  <Datagrid
@@ -401,10 +408,10 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
401
408
  beforeFetchData = {(args)=>{
402
409
  let {fetchOptions:opts,force,renderProgressBar} = args;
403
410
  opts = getFetchOptions({showError:showProgressRef.current,...opts});
404
- isInitializedRef.current = true;
405
411
  fetchOptionsRef.current = opts.fetchOptions;
406
412
  opts.fetchOptions.withTotal = true;
407
413
  sortRef.current = opts.fetchOptions.sort;
414
+ isInitializedRef.current = true;
408
415
  if(force){
409
416
  pageRef.current = firstPage;
410
417
  }