This commit is contained in:
Rizky 2024-08-15 12:02:58 +07:00
parent 4c158cf1b3
commit ec687fe052
1 changed files with 33 additions and 32 deletions

View File

@ -42,7 +42,7 @@ export const yjs_diff_local: SAction["yjs"]["diff_local"] = async function (
ts: history[id],
},
});
setTimeout(async () => {
const res = await _db.page_history.findMany({
where: {
id_page: id,
@ -76,11 +76,12 @@ export const yjs_diff_local: SAction["yjs"]["diff_local"] = async function (
}
last_ts = ts;
}
await _db.page_history.deleteMany({
_db.page_history.deleteMany({
where: { id: { in: ids } },
});
});
} else {
await _db.page_history.updateMany({
_db.page_history.updateMany({
data: {
content_tree: await gzipAsync(JSON.stringify(root.toJSON())),
},
@ -91,7 +92,7 @@ export const yjs_diff_local: SAction["yjs"]["diff_local"] = async function (
});
}
await _db.page.update({
_db.page.update({
where: { id },
data: {
content_tree: root.toJSON(),