correctly show/hide #no-styles message in the popup

This commit is contained in:
tophf 2017-08-31 13:41:48 +03:00
parent 35615eb2d4
commit 4c616442f6

View File

@ -318,6 +318,8 @@ Object.assign(handleEvent, {
}); });
if (ok) { if (ok) {
deleteStyleSafe({id}).then(() => { deleteStyleSafe({id}).then(() => {
// don't wait for the async notifyAllTabs as we check the children right away
handleDelete(id);
// update view with 'No styles installed for this site' message // update view with 'No styles installed for this site' message
if (!installed.children.length) { if (!installed.children.length) {
showStyles([]); showStyles([]);
@ -402,7 +404,7 @@ function handleUpdate(style) {
// Add an entry when a new style for the current url is installed // Add an entry when a new style for the current url is installed
if (tabURL && BG.getApplicableSections({style, matchUrl: tabURL, stopOnFirst: true}).length) { if (tabURL && BG.getApplicableSections({style, matchUrl: tabURL, stopOnFirst: true}).length) {
document.body.classList.remove('blocked'); document.body.classList.remove('blocked');
$$('.blocked-info').forEach(el => el.remove()); $$('.blocked-info, #no-styles').forEach(el => el.remove());
createStyleElement({style}); createStyleElement({style});
} }
} }