mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	fix(help): missing branches if it was relocated
This commit is contained in:
		
							parent
							
								
									318f2d1f8c
								
							
						
					
					
						commit
						efd9244684
					
				@ -1,4 +1,5 @@
 | 
				
			|||||||
import BAttribute from "../becca/entities/battribute.js";
 | 
					import BAttribute from "../becca/entities/battribute.js";
 | 
				
			||||||
 | 
					import BBranch from "../becca/entities/bbranch.js";
 | 
				
			||||||
import type { HiddenSubtreeItem } from "@triliumnext/commons";
 | 
					import type { HiddenSubtreeItem } from "@triliumnext/commons";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import becca from "../becca/becca.js";
 | 
					import becca from "../becca/becca.js";
 | 
				
			||||||
@ -313,6 +314,17 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
 | 
				
			|||||||
        }));
 | 
					        }));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);
 | 
					        branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // If the note exists but doesn't have a branch in the expected parent,
 | 
				
			||||||
 | 
					        // create the missing branch to ensure it's in the correct location
 | 
				
			||||||
 | 
					        if (!branch) {
 | 
				
			||||||
 | 
					            branch = new BBranch({
 | 
				
			||||||
 | 
					                noteId: item.id,
 | 
				
			||||||
 | 
					                parentNoteId: parentNoteId,
 | 
				
			||||||
 | 
					                notePosition: item.notePosition !== undefined ? item.notePosition : undefined,
 | 
				
			||||||
 | 
					                isExpanded: item.isExpanded !== undefined ? item.isExpanded : false
 | 
				
			||||||
 | 
					            }).save();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const attrs = [...(item.attributes || [])];
 | 
					    const attrs = [...(item.attributes || [])];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user