@economic/taco 2.58.0 → 2.58.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/dist/taco.cjs +33 -2
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.js +33 -2
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -53147,6 +53147,27 @@ function reducer(state, action) {
|
|
53147
53147
|
temporaryRows: state.temporaryRows.filter((row) => row[rowIdentityAccessor] !== rowId)
|
53148
53148
|
};
|
53149
53149
|
}
|
53150
|
+
case "complete": {
|
53151
|
+
const { changes, handleDiscard } = payload;
|
53152
|
+
if (JSON.stringify(changes) !== JSON.stringify(state.changes.rows[rowId])) {
|
53153
|
+
return {
|
53154
|
+
...state,
|
53155
|
+
changes: {
|
53156
|
+
...state.changes,
|
53157
|
+
originals: setWith(
|
53158
|
+
state.changes.originals,
|
53159
|
+
rowId,
|
53160
|
+
{ ...state.changes.originals[rowId], ...changes },
|
53161
|
+
Object
|
53162
|
+
)
|
53163
|
+
}
|
53164
|
+
};
|
53165
|
+
}
|
53166
|
+
if (typeof handleDiscard === "function") {
|
53167
|
+
handleDiscard();
|
53168
|
+
}
|
53169
|
+
return state;
|
53170
|
+
}
|
53150
53171
|
case "setRowStatus": {
|
53151
53172
|
const { status } = payload;
|
53152
53173
|
return {
|
@@ -53364,7 +53385,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53364
53385
|
for (const rowId2 of Object.keys(changes)) {
|
53365
53386
|
const status = getRowStatus(rowId2);
|
53366
53387
|
try {
|
53367
|
-
const rowChanges = changes[rowId2] ?? {};
|
53388
|
+
const rowChanges = JSON.parse(JSON.stringify(changes[rowId2] ?? {}));
|
53368
53389
|
if (!Object.keys(rowChanges).length || status === "saving" || status === "errored") {
|
53369
53390
|
continue;
|
53370
53391
|
}
|
@@ -53380,7 +53401,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53380
53401
|
}
|
53381
53402
|
}
|
53382
53403
|
await handleSave(changeSet);
|
53383
|
-
await
|
53404
|
+
await complete(rowId2, table, rowChanges);
|
53384
53405
|
setRowStatus(rowId2, "saved");
|
53385
53406
|
setTimeout(() => {
|
53386
53407
|
setRowStatus(rowId2, void 0);
|
@@ -53429,6 +53450,16 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53429
53450
|
await handleDiscard();
|
53430
53451
|
}
|
53431
53452
|
}
|
53453
|
+
async function complete(rowId, table, changes) {
|
53454
|
+
const handleDiscard2 = async () => {
|
53455
|
+
await discardChanges(rowId, table);
|
53456
|
+
};
|
53457
|
+
dispatch({
|
53458
|
+
type: "complete",
|
53459
|
+
rowId,
|
53460
|
+
payload: { rowIdentityAccessor, changes, handleDiscard: handleDiscard2 }
|
53461
|
+
});
|
53462
|
+
}
|
53432
53463
|
return {
|
53433
53464
|
// row
|
53434
53465
|
getRowValue,
|