penge/block-site

Should we use cloud synced storage?

Closed this issue · 4 comments

olfek commented

Should we use cloud synced storage?

Should we use storage.sync instead of storage.local so that settings are backed up?
(https://developer.chrome.com/docs/extensions/reference/storage/#usage)

File in question
https://github.com/penge/block-site/blob/master/src/helpers/storage.ts

BUT

we don't want to sync unimportant data such as site block count.

penge commented

I think it's a matter of preference. What storage.sync does, it syncs the storage across other computers where you are using Chrome with the same Google Account. In our case, that would mean the same blocked rules apply on every computer of yours. I think it's better NOT to make that decision for the user and therefore NOT to sync, as one might want to block youtube.com at work, but allow at home. When you uninstall the extension, what was in storage.sync is removed as well, so it doesn't back up the data.

Just a sidenote: When working with storage.sync, need to be careful about MAX_WRITE_OPERATIONS_PER_MINUTE quota and so any save as you type would need to change to have a dedicated Save button.

olfek commented

The work/home example makes sense, for this problem, I don't think the correct solution is to avoid sync altogether, as someone might have an extensive carefully curated blocklist which they might wish to easily preserve between installations. The better solution for this particular problem is to introduce profiles. The user can then easily switch between a "work" or "home" blocklist.

When you uninstall the extension, what was in storage.sync is removed as well, so it doesn't back up the data.

When an extension is uninstalled, won't storage.local be removed too? So in both cases, the data is lost, which is fine in my opinion because the user chose to uninstall.

penge commented

When an extension is uninstalled, won't storage.local be removed too? So in both cases, the data is lost, which is fine in my opinion because the user chose to uninstall.

It's exactly like that. And actually not having leftovers is preferable. It is as it should be.

The user can then easily switch between a "work" or "home" blocklist.

This is a great idea and I love it! We could have a combination of local/sync storage. Sync would hold profiles and blocked list (to be synced across computers). Local would hold the name of profile to use (to be applied on current computer only).
Haven't mentioned it, but sync storage is limited to 100KB only and it might be a deal breaker at some point. Actually, anything that is user edited might cause hitting this limit immediately (copy paste larger text) and cause some problems. Sync storage is ideal for settings where storage size is predictable or known to be below 100KB.

olfek commented

Haven't mentioned it, but sync storage is limited to 100KB only and it might be a deal breaker at some point. Actually, anything that is user edited might cause hitting this limit immediately (copy paste larger text) and cause some problems. Sync storage is ideal for settings where storage size is predictable or known to be below 100KB.

Hmmm yep that will be a problem for this extension 🤔🤔🤔