javoire / dyslexia-friendly

Google Chrome extension that increases readability for people with dyslexia
https://chrome.google.com/webstore/detail/dyslexia-friendly/miepjgfkkommhllbbjaedffcpkncboeo?hl=en
GNU Affero General Public License v3.0
9 stars 2 forks source link

add "version" to config in storage to wipe on updates #74

Closed javoire closed 2 weeks ago

javoire commented 1 year ago

When a new version is published, whatever is stored in chrome.storage remains from the old version. It's a good practice to wipe the existing storage when a new version is published to avoid conflicts and bugs. At least if the new version changes the schema of the storage object, but to be safe it's best to always wipe it. That way no old config keys will remain to potentially cause issues, though low likelihood.

Or check if the existing config object keys do not match the keys in the default config, and in that case wipe it. Could potentially be bug prone though

javoire commented 11 months ago

I think easiest and less intrusive is to just have an incremental schema version that only changes when the config schema changes (instead of every release version of the extension.. )

eg

var DEFAULT_CONFIG = {
  schemaVersion: 1,
  // inputs:
  // these are the `name="something-checkbox"` etc,
  // names need to be manually in sync...
  extensionEnabled: true,
  fontEnabled: true,
  rulerEnabled: true,
  rulerSize: 30,
  fontChoice: 'opendyslexic'
};
javoire commented 4 months ago

only wipe storage if schema new version is higher

javoire commented 2 weeks ago

config is always wiped on updates already https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled https://github.com/javoire/dyslexia-friendly/blob/master/src/js/background.js#L43