mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	fix attribute loading for mobile
This commit is contained in:
		
							parent
							
								
									f8d32d64f5
								
							
						
					
					
						commit
						246dfbdcb4
					
				@ -13,13 +13,25 @@ const $savedIndicator = $("#saved-indicator");
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
let attributePromise;
 | 
					let attributePromise;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function refreshAttributes() {
 | 
					function invalidateAttributes() {
 | 
				
			||||||
 | 
					    attributePromise = null;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function reloadAttributes() {
 | 
				
			||||||
    attributePromise = server.get('notes/' + noteDetailService.getCurrentNoteId() + '/attributes');
 | 
					    attributePromise = server.get('notes/' + noteDetailService.getCurrentNoteId() + '/attributes');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function refreshAttributes() {
 | 
				
			||||||
 | 
					    reloadAttributes();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await showAttributes();
 | 
					    await showAttributes();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getAttributes() {
 | 
					async function getAttributes() {
 | 
				
			||||||
 | 
					    if (!attributePromise) {
 | 
				
			||||||
 | 
					        reloadAttributes();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return await attributePromise;
 | 
					    return await attributePromise;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -286,5 +298,6 @@ async function promotedAttributeChanged(event) {
 | 
				
			|||||||
export default {
 | 
					export default {
 | 
				
			||||||
    getAttributes,
 | 
					    getAttributes,
 | 
				
			||||||
    showAttributes,
 | 
					    showAttributes,
 | 
				
			||||||
    refreshAttributes
 | 
					    refreshAttributes,
 | 
				
			||||||
 | 
					    invalidateAttributes
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -182,6 +182,10 @@ async function loadNoteDetail(noteId) {
 | 
				
			|||||||
        // needs to happen after loading the note itself because it references current noteId
 | 
					        // needs to happen after loading the note itself because it references current noteId
 | 
				
			||||||
        attributeService.refreshAttributes();
 | 
					        attributeService.refreshAttributes();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					        // mobile usually doesn't need attributes so we just invalidate
 | 
				
			||||||
 | 
					        attributeService.invalidateAttributes();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (isNewNoteCreated) {
 | 
					    if (isNewNoteCreated) {
 | 
				
			||||||
        isNewNoteCreated = false;
 | 
					        isNewNoteCreated = false;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user