mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
fix(sync): don't delete a local row when the server can't send its copy (#1650)
* fix(sync): don't delete a local row when the server can't send its copy A push conflict on a live record whose server row failed to serialize came back as row: null, deleted: false, and the desktop treated that as a delete. The server now rejects that op as unavailable, the desktop never deletes on a conflict without a row, and serialization failures are logged. * fix(sync): retry temporarily unavailable records
This commit is contained in:
1 parent
bc74fba3f5
commit
071711dafc
4 files changed
+172
-6
No files matched your search
@@ -134,12 +134,23 @@ export async function applyPush(
|
||||
const record = await getRecord(userId, op.entityType, op.syncId);
|
||||
const currentRevision = record?.revision ?? 0;
|
||||
if (op.baseRevision !== currentRevision) {
|
||||
const row = record?.deleted ? null : (wire.get(key) ?? null);
|
||||
// A live record with no row failed to serialize; a conflict without a
|
||||
// row would read as a delete on the desktop.
|
||||
if (record && !record.deleted && !row) {
|
||||
results.set(key, {
|
||||
...base,
|
||||
status: "rejected",
|
||||
reason: "unavailable",
|
||||
});
|
||||
continue;
|
||||
}
|
||||
results.set(key, {
|
||||
...base,
|
||||
status: "conflict",
|
||||
revision: currentRevision,
|
||||
deleted: !!record?.deleted,
|
||||
row: record?.deleted ? null : (wire.get(key) ?? null),
|
||||
row,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user