@ -972,36 +972,36 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const noteIdsToUpdate = new Set ( ) ;
const noteIdsToReload = new Set ( ) ;
for ( const a ttr of loadResults . getAttributes ( ) ) {
if ( a ttr. type === 'label' && [ 'iconClass' , 'cssClass' , 'workspace' , 'workspaceIconClass' , 'archived' ] . includes ( a ttr. name ) ) {
if ( a ttr. isInheritable ) {
noteIdsToReload . add ( a ttr. noteId ) ;
for ( const ecA ttr of loadResults . getAttributes ( ) ) {
if ( ecA ttr. type === 'label' && [ 'iconClass' , 'cssClass' , 'workspace' , 'workspaceIconClass' , 'archived' ] . includes ( ecA ttr. name ) ) {
if ( ecA ttr. isInheritable ) {
noteIdsToReload . add ( ecA ttr. noteId ) ;
}
else {
noteIdsToUpdate . add ( a ttr. noteId ) ;
noteIdsToUpdate . add ( ecA ttr. noteId ) ;
}
}
else if ( attr. type === 'relation' && a ttr. name === 'template' ) {
else if ( ecAttr. type === 'relation' && ecA ttr. name === 'template' ) {
// missing handling of things inherited from template
noteIdsToReload . add ( a ttr. noteId ) ;
noteIdsToReload . add ( ecA ttr. noteId ) ;
}
else if ( attr. type === 'relation' && a ttr. name === 'imageLink' ) {
const note = froca . getNoteFromCache ( a ttr. noteId ) ;
else if ( ecAttr. type === 'relation' && ecA ttr. name === 'imageLink' ) {
const note = froca . getNoteFromCache ( ecA ttr. noteId ) ;
if ( note && note . getChildNoteIds ( ) . includes ( a ttr. value ) ) {
if ( note && note . getChildNoteIds ( ) . includes ( ecA ttr. value ) ) {
// there's new/deleted imageLink betwen note and its image child - which can show/hide
// the image (if there is a imageLink relation between parent and child then it is assumed to be "contained" in the note and thus does not have to be displayed in the tree)
noteIdsToReload . add ( a ttr. noteId ) ;
noteIdsToReload . add ( ecA ttr. noteId ) ;
}
}
}
for ( const b ranch of loadResults . getBranches ( ) ) {
for ( const ecB ranch of loadResults . getBranches ( ) ) {
// adding noteId itself to update all potential clones
noteIdsToUpdate . add ( b ranch. noteId ) ;
noteIdsToUpdate . add ( ecB ranch. noteId ) ;
for ( const node of this . getNodesByBranch ( b ranch) ) {
if ( b ranch. isDeleted ) {
for ( const node of this . getNodesByBranch ( ecB ranch) ) {
if ( ecB ranch. isDeleted ) {
if ( node . isActive ( ) ) {
const newActiveNode = node . getNextSibling ( )
|| node . getPrevSibling ( )
@ -1016,22 +1016,22 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
node . remove ( ) ;
}
noteIdsToUpdate . add ( b ranch. parentNoteId ) ;
noteIdsToUpdate . add ( ecB ranch. parentNoteId ) ;
}
}
if ( ! b ranch. isDeleted ) {
for ( const parentNode of this . getNodesByNoteId ( b ranch. parentNoteId ) ) {
if ( ! ecB ranch. isDeleted ) {
for ( const parentNode of this . getNodesByNoteId ( ecB ranch. parentNoteId ) ) {
if ( parentNode . isFolder ( ) && ! parentNode . isLoaded ( ) ) {
continue ;
}
const found = ( parentNode . getChildren ( ) || [ ] ) . find ( child => child . data . noteId === b ranch. noteId ) ;
const found = ( parentNode . getChildren ( ) || [ ] ) . find ( child => child . data . noteId === ecB ranch. noteId ) ;
if ( ! found ) {
// make sure it's loaded
await froca . getNote ( b ranch. noteId ) ;
const frocaBranch = froca . getBranch ( b ranch. branchId ) ;
await froca . getNote ( ecB ranch. noteId ) ;
const frocaBranch = froca . getBranch ( ecB ranch. branchId ) ;
// we're forcing lazy since it's not clear if the whole required subtree is in froca
parentNode . addChildren ( [ this . prepareNode ( frocaBranch , true ) ] ) ;
@ -1039,7 +1039,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
this . sortChildren ( parentNode ) ;
// this might be a first child which would force an icon change
noteIdsToUpdate . add ( b ranch. parentNoteId ) ;
noteIdsToUpdate . add ( ecB ranch. parentNoteId ) ;
}
}
}