mirror of
https://github.com/zadam/trilium.git
synced 2024-09-22 00:26:01 +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;
|
||||
|
||||
async function refreshAttributes() {
|
||||
function invalidateAttributes() {
|
||||
attributePromise = null;
|
||||
}
|
||||
|
||||
function reloadAttributes() {
|
||||
attributePromise = server.get('notes/' + noteDetailService.getCurrentNoteId() + '/attributes');
|
||||
}
|
||||
|
||||
async function refreshAttributes() {
|
||||
reloadAttributes();
|
||||
|
||||
await showAttributes();
|
||||
}
|
||||
|
||||
async function getAttributes() {
|
||||
if (!attributePromise) {
|
||||
reloadAttributes();
|
||||
}
|
||||
|
||||
return await attributePromise;
|
||||
}
|
||||
|
||||
|
@ -286,5 +298,6 @@ async function promotedAttributeChanged(event) {
|
|||
export default {
|
||||
getAttributes,
|
||||
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
|
||||
attributeService.refreshAttributes();
|
||||
}
|
||||
else {
|
||||
// mobile usually doesn't need attributes so we just invalidate
|
||||
attributeService.invalidateAttributes();
|
||||
}
|
||||
|
||||
if (isNewNoteCreated) {
|
||||
isNewNoteCreated = false;
|
||||
|
|
Loading…
Reference in a new issue