WIP: Localforage Replacement #2406

Draft
lambadalambda wants to merge 2 commits from gitlab-mr-iid-1139 into develop

A localforage compatible indexeddb-only key value store.

It can use the old database, but by default it will use a new one. See the comment for how to enable usage of the existing db.

File size is 5kb vs 90kb

A localforage compatible indexeddb-only key value store. It can use the old database, but by default it will use a new one. See the comment for how to enable usage of the existing db. File size is 5kb vs 90kb
Author
Owner

This now also supports localstorage fallback, tested with chrome which for some reason only gives me indexeddb in an incognito window ????

This now also supports localstorage fallback, tested with chrome which for some reason only gives me indexeddb in an incognito window ????
Author
Owner

Adding WIP again because while this works, if we actually merge it it should default to the old localforage stuff so people's stuff doesn't get reset.

Adding WIP again because while this works, if we actually merge it it should default to the old localforage stuff so people's stuff doesn't get reset.
Member

I'm having trouble parsing this, so you get localstorage normally in chrome or you always get indexeddb regardless of incognito? if latter, then it's normal afaik

I'm having trouble parsing this, so you get localstorage normally in chrome or you always get indexeddb regardless of incognito? if latter, then it's normal afaik
Member

I don't think we should ever change name of the database, the point was to switch the layer in between the database and the application so it's all seamless, not to create a new database

I don't think we should ever change name of the database, the point was to switch the layer in between the database and the application so it's all seamless, not to create a new database
Author
Owner

Sorry, I have this behavior in chrome:

  1. Normal window: Indexeddb doesn't work, i only get localstorage.
  2. Incognito window: Indexeddb does work.

Weird, but made it easy to test if the localstorage fallback works :)

Sorry, I have this behavior in chrome: 1. Normal window: Indexeddb doesn't work, i only get localstorage. 2. Incognito window: Indexeddb does work. Weird, but made it easy to test if the localstorage fallback works :)
Author
Owner

This was just to not overwrite stuff during testing, before un-WIPing this should be changed to the localforage defaults.

This was just to not overwrite stuff during testing, before un-WIPing this should be changed to the localforage defaults.
Member

I hope you test in localhost where it doesn't matter and not by deploying ;)

I hope you test in localhost where it doesn't matter and not by deploying ;)
Member

yeah that's kinda weird but fine then

it's also easy to test it by making the indexeddb files read only in your file system (something I learned at old job)

yeah that's kinda weird but fine then it's also easy to test it by making the indexeddb files read only in your file system (something I learned at old job)
Author
Owner

read only in your file system

maybe that's what happened somehow

> read only in your file system maybe that's what happened somehow
Author
Owner

i test by copying it over to soykaf and waiting for complaints

i test by copying it over to soykaf and waiting for complaints
Member

what if browser has support for indexeddb but also has data in localstorage? I've seen it before with localforage at least.

what if browser has support for indexeddb but also has data in localstorage? I've seen it before with localforage at least.
Member

I would also test it on shitty mobile browsers like safari/android 4.x, ucbro, as well as shitty desktop browsers like safari/mememoon. Especially with migrations.

I would also test it on shitty mobile browsers like safari/android 4.x, ucbro, as well as shitty desktop browsers like safari/mememoon. **Especially** with migrations.
Author
Owner

i can check what localforage does in this case.

i can check what localforage does in this case.
This pull request has changes conflicting with the target branch.
  • src/lib/persisted_state.js
  • src/sw.js
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin gitlab-mr-iid-1139:gitlab-mr-iid-1139
git switch gitlab-mr-iid-1139

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch develop
git merge --no-ff gitlab-mr-iid-1139
git switch gitlab-mr-iid-1139
git rebase develop
git switch develop
git merge --ff-only gitlab-mr-iid-1139
git switch gitlab-mr-iid-1139
git rebase develop
git switch develop
git merge --no-ff gitlab-mr-iid-1139
git switch develop
git merge --squash gitlab-mr-iid-1139
git switch develop
git merge --ff-only gitlab-mr-iid-1139
git switch develop
git merge gitlab-mr-iid-1139
git push origin develop
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!2406
No description provided.