save the writing

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

View File

@ -1120,19 +1120,22 @@ 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 have prevSync,
// we don't need to do anything, because the record is already there!
} else {
// if we don't have prevSync, we use remote entity AND local mtime // if we don't have prevSync, we use remote entity AND local mtime
// as if it is "uploaded" // as if it is "uploaded"
if (entity === undefined && r.remote !== undefined) { if (r.remote !== undefined) {
entity = await decryptRemoteEntityInplace(r.remote, cipher); let entity = await decryptRemoteEntityInplace(r.remote, cipher);
entity = await fullfillMTimeOfRemoteEntityInplace( entity = await fullfillMTimeOfRemoteEntityInplace(
entity, entity,
r.local?.mtimeCli r.local?.mtimeCli
); );
}
if (entity !== undefined) { if (entity !== undefined) {
await upsertPrevSyncRecordByVaultAndProfile( await upsertPrevSyncRecordByVaultAndProfile(
db, db,
@ -1141,6 +1144,8 @@ const dispatchOperationToActualV3 = async (
entity entity
); );
} }
}
}
} else if ( } else if (
r.decision === "local_is_modified_then_push" || r.decision === "local_is_modified_then_push" ||
r.decision === "local_is_created_then_push" || r.decision === "local_is_created_then_push" ||