Changed deleted local ids to api ids

This commit is contained in:
2020-12-05 20:16:33 +01:00
parent 4ff230007c
commit b6cf9d2ed5
2 changed files with 12 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ export default {
pendingChanges: {
created: [],
updated: [],
deleted: []
deleted: [] // Stores apiId instead of localId
},
model: {
centerX: 0,
@@ -101,7 +101,7 @@ export default {
},
// Vuejs can not track changes of a set, so we do this magic hack to fix it
enqueuePendingNodeDeletion(id) {
enqueuePendingNodeDeletion({id, apiId}) {
let pending_deletes = new Set(this.pendingChanges.deleted);
let pending_updates = new Set(this.pendingChanges.updated);
let pending_creations = new Set(this.pendingChanges.created);
@@ -110,7 +110,9 @@ export default {
if (pending_creations.has(id)) {
pending_creations.delete(id);
} else {
pending_deletes.add(id);
if (apiId) {
pending_deletes.add(apiId);
}
}
pending_updates.delete(id);
@@ -133,7 +135,7 @@ export default {
handleNodeMove() {
// TODO
},
handleLinkBreak({from,to}) {
handleLinkBreak({from, to}) {
this.enqueuePendingNodeUpdate(from);
this.enqueuePendingNodeUpdate(to);
},