-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(indexed-db): reset now clears db tables #2445
Conversation
Co-authored-by: @taboca Co-authored-by: @mquasar Fix: getAlby#2435
🚀 Thanks for the pull request! Here are the current build files for testing: Download and unzip the file for your browser. Refer to the readme for detailed install instructions. Don't forget: keep earning sats! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
As @rolznz noted I think the browser.storage.clear()
APIs would be a better fit here as they delete all data and do not need to be adjusted in case there are new tables added in future.
We tried that but the data still 'lives on' in the IndexedDB, apparently. Does it make sense? |
Thanks for supporting us @reneaaron and @rolznz Although there is a situation that loading data ( such as payments ) comes from browser.storage API - which would indeed suggest that just deleting browser.storage is enough - yet based on local and limited tests, we have stumbled in a situation where IndexedDB data was persistent. The part of the code that gives us that idea is the function loadFromStorage:
In addition, notice the following section example where the logic gives up the load sync from browser.storage API in the situation where IndexedDB data exists: https://github.com/getAlby/lightning-browser-extension/blob/5bddad27cd0f58dcb83ffbceb5f3cf1317bb517c/src/extension/background-script/db.ts#LL116C6-L129C12 With the above said it is correct that there is a situation where IndexedDB is not present, which indeed require us to also clear the data from browser.storage
Some other observations #2435 (comment) With the above said, if the suggestion has to do with easy maintenance, and if we do the "browser.storage.clear()" then we would have to keep some consistency with wiping the IndexedDB database entirely too? Another idea is to try to do the maintenance from the loadFromStorage function in db.ts which is the code that gets kicked in app initialization time. |
@mquasar @taboca thanks for testing and looking deeper into the issue. I think the goal is to delete absolutely everything when resetting the extension. So any and all storage mechanisms (indexedDb, browser.storage, etc) we save data to should be completely cleared. |
Ok, I will check then the other aspects of DB that seem to be there, such as "LBE-AVAILABILITY-CHECK" and the ways to clear all the DBs. |
We have just updated the patch with the suggestions. It's much simpler now :) Thanks @rolznz !! |
@fczuardi I made some more simplifications. Could you please review the changes? |
@reneaaron I think this PR is ready for review now. 💪 |
looks good to me. @reneaaron have a look and merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @fczuardi! 💪
tACK
Co-authored-by: @taboca
Co-authored-by: @mquasar
Describe the changes you have made in this PR
A clear and concise description of what you want to happen
Link this PR to an issue [optional]
Fix: #2435
Type of change
(Remove other not matching type)
fix
: Bug fix (non-breaking change which fixes an issue)feat
: New feature (non-breaking change which adds functionality)feat!
: Breaking change (fix or feature that would cause existing functionality to not work as expected)docs
: Documentation updateScreenshots of the changes [optional]
Add screenshots to make your changes easier to understand. You can also add a video here.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist