@fto-consult/expo-ui 6.74.4 → 6.74.7
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
@@ -169,7 +169,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
169
169
|
testID = defaultStr(testID,"RNSWRDatagridComponent");
|
170
170
|
React.useEffect(()=>{
|
171
171
|
showProgressRef.current = false;
|
172
|
-
});
|
172
|
+
},[showProgressRef.current.current]);
|
173
173
|
const {error, isValidating,isLoading,data:result,refresh} = useSWR(fetchPath,{
|
174
174
|
fetcher : (url,opts)=>{
|
175
175
|
if(!isInitializedRef.current) {
|
@@ -232,7 +232,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
232
232
|
},500);
|
233
233
|
},[error]);
|
234
234
|
const doRefresh = (showProgress)=>{
|
235
|
-
showProgressRef.current = showProgress ? typeof showProgress ==='boolean' :
|
235
|
+
showProgressRef.current = showProgress ? typeof showProgress ==='boolean' : false;
|
236
236
|
refresh();
|
237
237
|
}
|
238
238
|
const canPaginate = ()=>{
|
@@ -407,6 +407,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
407
407
|
if(force){
|
408
408
|
pageRef.current = firstPage;
|
409
409
|
}
|
410
|
+
console.log("will fetch ",force,props);
|
410
411
|
doRefresh(force);
|
411
412
|
return false;
|
412
413
|
}}
|
@@ -710,7 +710,12 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
710
710
|
if(isPromise(upToDB)){
|
711
711
|
upToDB.then((upserted)=>{
|
712
712
|
const willCloseAfterSave = action === 'save2close' || !hasManyData;
|
713
|
-
let
|
713
|
+
let hasUpserted = this.isDocEditing(upserted);
|
714
|
+
if(!hasUpserted && isObj(upserted) && isObj(upserted.data) && this.isDocEditing(upserted.data)){
|
715
|
+
upserted = upserted.data;
|
716
|
+
hasUpserted = true;
|
717
|
+
}
|
718
|
+
const savedData = hasUpserted? upserted : data;
|
714
719
|
const newArgs = {tableName,actionName:action,action,table:this.table,data:savedData,result:upserted,context};
|
715
720
|
APP.trigger(cActions.upsert(tableName),newArgs);
|
716
721
|
if(this.onSaveTableData(newArgs) === false || (isFunction(this.props.onSave)&& this.props.onSave(newArgs) === false)){
|
@@ -739,6 +744,15 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
739
744
|
} else {
|
740
745
|
notify('Données modifiée avec succès!!','success');
|
741
746
|
}
|
747
|
+
if(hasUpserted){
|
748
|
+
if(this.state.hasManyData && Array.isArray(this.state.datas)){
|
749
|
+
const sData = [...this.state.datas];
|
750
|
+
sData[this.state.currentIndex] = savedData;
|
751
|
+
return this.setState({data:upserted,datas:sData},closePreloader);
|
752
|
+
} else {
|
753
|
+
return this.setState({data:savedData},closePreloader);
|
754
|
+
}
|
755
|
+
}
|
742
756
|
closePreloader();
|
743
757
|
}).catch((e)=>{
|
744
758
|
console.log('error on saving table data ',e);
|