From e079e5f252ee39b222f3eb78e81d0a6bab6626d2 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Tue, 15 Aug 2017 20:58:50 -0700 Subject: fix loss of anki settings --- ext/bg/js/settings.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'ext') diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index 89b1581f..7bdd9f84 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -96,9 +96,6 @@ async function onFormOptionsChanged(e) { return; } - ankiErrorShow(); - ankiSpinnerShow(true); - const {optionsNew, optionsOld} = await formRead(); await optionsSave(optionsNew); @@ -109,7 +106,9 @@ async function onFormOptionsChanged(e) { optionsNew.anki.server !== optionsOld.anki.server; if (ankiUpdated) { + ankiSpinnerShow(true); await ankiDeckAndModelPopulate(optionsNew); + ankiErrorShow(); } } catch (e) { ankiErrorShow(e); @@ -414,9 +413,6 @@ async function onAnkiModelChanged(e) { return; } - ankiErrorShow(); - ankiSpinnerShow(true); - const element = $(this); const tab = element.closest('.tab-pane'); const tabId = tab.attr('id'); @@ -425,7 +421,9 @@ async function onAnkiModelChanged(e) { optionsNew.anki[tabId].fields = {}; await optionsSave(optionsNew); + ankiSpinnerShow(true); await ankiFieldsPopulate(element, optionsNew); + ankiErrorShow(); } catch (e) { ankiErrorShow(e); } finally { -- cgit v1.2.3