Changed deleted local ids to api ids
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user