dumbeau / AutoHotPie

Radial menus in Windows, aka PIE MENYOOS!
MIT License
340 stars 18 forks source link

Migrated to indexedDB for improved code #103

Closed ryjacky closed 1 year ago

ryjacky commented 1 year ago

Moving from storing user data using JSON file to usng indexedDB(IDB).

This should greatly improves code reliability and readability.

When using JSON file to store user data:

  1. The program needs to read/write all data at once, which is extremely inefficient and unsafe.
  2. File lock doesn't come by default, which is unsafe as well.
  3. Code is going to be unmanageable as the program grows.
  4. We have a more accessible setting file (which I don't think it matters much to most of the users)

Migrating to IDB could provides:

  1. Safer data access. As it locks the database file and write what's only needed to change or read what's needed only.
  2. Comes with database features such as indexed search etc. which results in a much more cleaner code and extra functionality.
  3. There is no need to communicate with ipcMain, which simplifies the code by a lot.
  4. Import/Export is still achievable, but need to be implemented in the future
  5. Schema, allowing a more robust data validation (The original JSON solution also has a custom one, but the one comes with dexie.js is way better)