Skip to content

Commit 689ef7c

Browse files
committed
fix: auto save default options on first loading options page
1 parent 1b644f2 commit 689ef7c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/js/chrome-options.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ const addTabOptions = (tabKey, values, options) => {
223223
// so that it doensn't seep into load time.
224224
requestAnimationFrame(cloneValue);
225225

226+
let duringLoad = true;
226227
const save = (newValue) => {
228+
const autoSave = chrome.options.opts.autoSave || duringLoad;
227229
requestAnimationFrame(() => {
228230
latestValue = newValue;
229231
const isEqual = util.deepEqual(value, newValue);
230232
const valueToSave = isLayout ? newValue : { [key]: newValue };
231-
if (chrome.options.opts.autoSave) {
233+
if (autoSave) {
232234
if (!isEqual) {
233235
chrome.storage.sync.set(valueToSave);
234236
showSavedAlert();
@@ -249,6 +251,8 @@ const addTabOptions = (tabKey, values, options) => {
249251
}
250252
});
251253
};
252-
return chrome.options.addOption(key, value, save, option);
254+
const $option = chrome.options.addOption(key, value, save, option);
255+
duringLoad = false;
256+
return $option;
253257
}));
254258
};

0 commit comments

Comments
 (0)