Fixed scene revision transaction error not caught. Deduping revision arrays.

This commit is contained in:
DebaucheryLibrarian 2024-10-12 22:13:46 +02:00
parent 06eb24d93a
commit 0c9e8a4a06
1 changed files with 4 additions and 2 deletions

View File

@ -766,7 +766,7 @@ async function applySceneRevision(revisionIds) {
await chain; await chain;
await knexOwner.transaction(async (trx) => { await knexOwner.transaction(async (trx) => {
await revision.deltas.map(async (delta) => { await Promise.all(revision.deltas.map(async (delta) => {
if ([ if ([
'title', 'title',
'description', 'description',
@ -793,7 +793,7 @@ async function applySceneRevision(revisionIds) {
} }
return null; return null;
}); }));
await knexOwner('scenes_revisions') await knexOwner('scenes_revisions')
.where('id', revision.id) .where('id', revision.id)
@ -896,6 +896,8 @@ export async function createSceneRevision(sceneId, { edits, comment, apply }, re
if (valueSet.size === baseSet.size && baseScene[key].every((id) => valueSet.has(id))) { if (valueSet.size === baseSet.size && baseScene[key].every((id) => valueSet.has(id))) {
return null; return null;
} }
return { key, value: Array.from(valueSet) };
} }
return { key, value }; return { key, value };