Hello,
I'm having a problem changing multiple records by thf sync at the same time. The records are saved correctly in the storage, however for some of the records the request (PUT) is not sent to the server. I'm using the thf-sync version below:
"@totvs/thf-sync": "^1.7.0", Changed record schema definition:
this.baleSchema = { name: "Bale", fields: ["recno", "branchCode", "crop", "code", "barCode", "case", "pack", "commercialClassification", "visualClassification", "status"], idField: "recno", getUrlApi: "UBAW08/bales", diffUrlApi: "UBAW08/bales/diff", pageSize: 50, deletedField: "deleted" }; Below is the loop to change the records (The test I performed had 32 records in the this.bales array :
for (const bale of this.bales) { bale.visualClassification = "11-2"; bale.commercialClassification = "11-2";
await this.baleService.save(bale).catch( (err) => { bOk = false; } );
if (!bOk) { break; } } The save() method used above:
save(bale): Promise { return new Promise((resolve, reject) => { this.getBaleModel().save(bale).then( (data) => { console.log("Salvou com sucesso: ", data); resolve(data); } ).catch( (err) => { console.log("Erro ao salvar o fardo: ", err); reject(err); } ); }); }