Skip to content

Commit 5a90892

Browse files
committed
fix: saving option default
closes #7
1 parent 5af2842 commit 5a90892

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/js/chrome-options.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ import * as util from './util.js';
213213
requestAnimationFrame(cloneValue);
214214

215215
const save = (newValue) => {
216-
latestValue = newValue;
217-
218216
requestAnimationFrame(() => {
217+
latestValue = newValue;
219218
const isEqual = util.deepEqual(value, newValue);
220219
if (chrome.options.opts.autoSave) {
221220
if (!isEqual) {
@@ -257,6 +256,10 @@ import * as util from './util.js';
257256

258257
if (value === undefined && option.default != null) {
259258
value = option.default;
259+
if ((!option.type || option.type === 'checkbox') &&
260+
option.options && typeof value === 'boolean') {
261+
value = { enabled: value };
262+
}
260263
if (chrome.options.opts.saveDefaults) {
261264
save(value);
262265
}

0 commit comments

Comments
 (0)