mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix doubling of notes after some actions
This commit is contained in:
parent
05e9669eaf
commit
49bca04ebb
@ -117,6 +117,15 @@ async function show() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearMap() {
|
||||||
|
// delete all endpoints and connections
|
||||||
|
// this is done at this point (after async operations) to reduce flicker to the minimum
|
||||||
|
jsPlumbInstance.deleteEveryEndpoint();
|
||||||
|
|
||||||
|
// without this we still end up with note boxes remaining in the canvas
|
||||||
|
$relationMapContainer.empty();
|
||||||
|
}
|
||||||
|
|
||||||
async function loadNotesAndRelations() {
|
async function loadNotesAndRelations() {
|
||||||
const noteIds = mapData.notes.map(note => note.noteId);
|
const noteIds = mapData.notes.map(note => note.noteId);
|
||||||
const data = await server.post("notes/relation-map", {noteIds});
|
const data = await server.post("notes/relation-map", {noteIds});
|
||||||
@ -142,11 +151,9 @@ async function loadNotesAndRelations() {
|
|||||||
|
|
||||||
mapData.notes = mapData.notes.filter(note => note.noteId in data.noteTitles);
|
mapData.notes = mapData.notes.filter(note => note.noteId in data.noteTitles);
|
||||||
|
|
||||||
// delete all endpoints and connections
|
|
||||||
// this is done at this point (after async operations) to reduce flicker to the minimum
|
|
||||||
jsPlumbInstance.deleteEveryEndpoint();
|
|
||||||
|
|
||||||
jsPlumbInstance.batch(async function () {
|
jsPlumbInstance.batch(async function () {
|
||||||
|
clearMap();
|
||||||
|
|
||||||
for (const note of mapData.notes) {
|
for (const note of mapData.notes) {
|
||||||
const title = data.noteTitles[note.noteId];
|
const title = data.noteTitles[note.noteId];
|
||||||
|
|
||||||
@ -244,11 +251,7 @@ function saveCurrentTransform() {
|
|||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
if (jsPlumbInstance) {
|
if (jsPlumbInstance) {
|
||||||
// delete all endpoints and connections
|
clearMap();
|
||||||
jsPlumbInstance.deleteEveryEndpoint();
|
|
||||||
|
|
||||||
// without this we still end up with note boxes remaining in the canvas
|
|
||||||
$relationMapContainer.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pzInstance) {
|
if (pzInstance) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user