Skip to content

Commit

Permalink
Only add the new default options to the user options if the extension…
Browse files Browse the repository at this point in the history
… version changes
  • Loading branch information
leonvogt committed Jul 6, 2024
1 parent 05722d8 commit 171aa68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/lib/devtool.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,23 @@ export default class Devtool {
}

addMissingDefaultOptions = (options) => {
if (options.addOptionsForVersion === this.version) return options

const defaultOptions = this.defaultOptions
for (const key in defaultOptions) {
if (options[key] === undefined) {
options[key] = defaultOptions[key]
}
}

options.addOptionsForVersion = this.version
return options
}

get version() {
return chrome.runtime.getManifest().version
}

get isFirefox() {
return navigator.userAgent.toLowerCase().indexOf("firefox") > -1
}
Expand Down
2 changes: 1 addition & 1 deletion src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ const getCurrentTabOrigin = async () => {
document.querySelector(".page-specific-options-wrapper").remove()
}

versionString.textContent = chrome.runtime.getManifest().version
versionString.textContent = devTool.version

const options = await devTool.getOptions()
initializeForm(options)
Expand Down

0 comments on commit 171aa68

Please sign in to comment.