save the writing

This commit is contained in:
fyears 2024-04-04 22:20:36 +08:00
parent cb6f7e572c
commit 640f1e56f1

View File

@ -1120,26 +1120,31 @@ const dispatchOperationToActualV3 = async (
r.decision === "conflict_created_then_do_nothing" || r.decision === "conflict_created_then_do_nothing" ||
r.decision === "folder_existed_both_then_do_nothing" r.decision === "folder_existed_both_then_do_nothing"
) { ) {
// !! we need to upsert the record, // !! we MIGHT need to upsert the record,
// so that next time we can determine the change delta // so that next time we can determine the change delta
// if we have prevSync, we store it because it should keep all necessary info
let entity = r.prevSync; if (r.prevSync !== undefined) {
// if we don't have prevSync, we use remote entity AND local mtime // if we have prevSync,
// as if it is "uploaded" // we don't need to do anything, because the record is already there!
if (entity === undefined && r.remote !== undefined) { } else {
entity = await decryptRemoteEntityInplace(r.remote, cipher); // if we don't have prevSync, we use remote entity AND local mtime
entity = await fullfillMTimeOfRemoteEntityInplace( // as if it is "uploaded"
entity, if (r.remote !== undefined) {
r.local?.mtimeCli let entity = await decryptRemoteEntityInplace(r.remote, cipher);
); entity = await fullfillMTimeOfRemoteEntityInplace(
} entity,
if (entity !== undefined) { r.local?.mtimeCli
await upsertPrevSyncRecordByVaultAndProfile( );
db,
vaultRandomID, if (entity !== undefined) {
profileID, await upsertPrevSyncRecordByVaultAndProfile(
entity db,
); vaultRandomID,
profileID,
entity
);
}
}
} }
} else if ( } else if (
r.decision === "local_is_modified_then_push" || r.decision === "local_is_modified_then_push" ||