fix attribute loading for mobile

This commit is contained in:
azivner 2018-12-24 23:08:43 +01:00
parent f8d32d64f5
commit 246dfbdcb4
2 changed files with 19 additions and 2 deletions

View file

@ -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
}

View file

@ -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;