@fto-consult/expo-ui 6.69.0 → 6.69.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
@@ -193,15 +193,27 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
193
193
|
opts.showError = false;
|
194
194
|
}
|
195
195
|
if(typeof fetcher =='function'){
|
196
|
-
return fetcher(url,opts)
|
196
|
+
return fetcher(url,opts).then((r)=>{
|
197
|
+
showProgressRef.current = false;
|
198
|
+
return r;
|
199
|
+
}).catch((r)=>{
|
200
|
+
showProgressRef.current = false;
|
201
|
+
return r;
|
202
|
+
});
|
197
203
|
}
|
198
|
-
return apiFetch(url,opts)
|
204
|
+
return apiFetch(url,opts).then((r)=>{
|
205
|
+
showProgressRef.current = false;
|
206
|
+
return r;
|
207
|
+
}).catch((r)=>{
|
208
|
+
showProgressRef.current = false;
|
209
|
+
return r;
|
210
|
+
});
|
199
211
|
},
|
200
212
|
swrOptions : getSWROptions(swrConfig.refreshTimeout)
|
201
213
|
});
|
202
214
|
const dataRef = React.useRef(null);
|
203
215
|
const totalRef = React.useRef(0);
|
204
|
-
const loading = (customIsLoading === true || isLoading || isValidating);
|
216
|
+
const loading = (customIsLoading === true || isLoading || (isValidating && showProgressRef.current));
|
205
217
|
const {data,total} = React.useMemo(()=>{
|
206
218
|
if((loading && customIsLoading !== false) || !isObjOrArray(result)){
|
207
219
|
return {data:dataRef.current,total:totalRef.current};
|
@@ -228,7 +240,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
228
240
|
},500);
|
229
241
|
},[error]);
|
230
242
|
const doRefresh = (showProgress)=>{
|
231
|
-
showProgressRef.current = showProgress ? typeof showProgress ==='boolean' :
|
243
|
+
showProgressRef.current = showProgress ? typeof showProgress ==='boolean' : showProgressRef.current;
|
232
244
|
refresh();
|
233
245
|
}
|
234
246
|
const canPaginate = ()=>{
|
@@ -391,7 +403,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
391
403
|
handleQueryLimit = {false}
|
392
404
|
handlePagination = {false}
|
393
405
|
autoSort = {canSortRemotely()? false : true}
|
394
|
-
isLoading = {loading
|
406
|
+
isLoading = {loading && showProgressRef.current || false}
|
395
407
|
beforeFetchData = {(args)=>{
|
396
408
|
if(typeof beforeFetchData =="function" && beforeFetchData(args)==false) return;
|
397
409
|
let {fetchOptions:opts,force} = args;
|