diff --git a/ext/src/ui/options/Options.svelte b/ext/src/ui/options/Options.svelte index c54881a..5bda111 100644 --- a/ext/src/ui/options/Options.svelte +++ b/ext/src/ui/options/Options.svelte @@ -16,7 +16,7 @@ let formElement: HTMLFormElement; let isFormValid = true; - let showSavedIndicator = false; + let isSavedIndicatorVisible = false; let platform: string; @@ -37,11 +37,10 @@ /** Saves options and show indicator. */ async function onFormSubmit() { formElement.reportValidity(); + if (!opts) return; try { - if (!opts) return; - - // Remove unnecessary prop + // Remove implicit whitelist item props for (const item of opts.siteWhitelist) { if (item.isUserAgentDisabled === false) { delete item.isUserAgentDisabled; @@ -51,9 +50,9 @@ await options.setAll(opts); // 1s long saved indicator - showSavedIndicator = true; + isSavedIndicatorVisible = true; setTimeout(() => { - showSavedIndicator = false; + isSavedIndicatorVisible = false; }, 1000); } catch (err) { logger.error("Failed to save options!"); @@ -69,7 +68,7 @@ } -{#if opts} +{#if opts && platform}