-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 loss of local storage in Electron #6313
Conversation
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.
I'm not sure adding the dependency to core
would be the way forward.
(the CI is failing because of it)
Signed-off-by: Nigel Westbury <nigelipse@miegel.org>
688ea18
to
85af2b0
Compare
Wouldn't we rather bind a different implementation in the Electron Inversify module instead of checking at runtime? |
Good question, and that was how I was originally going to implement this. I chose to do it this way because:
|
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.
This is because the window path name changes each time the program is run (when run in production mode)
Nice catch!
Run an Electron app on Linux.
I have verified it on Windows but the window.location.pathname
has the same effect.
👍 Thank you for the fix.
@spoenemann Are you happy I merge this? |
👍 |
What it does
As a result of #904 the window path name is prefixed to the local storage key. However in the Electron version this can break the persistence of local storage. This is because the window path name changes each time the program is run (when run in production mode). Therefore I suggest reverting to exclude pathname if running in Electron.
How to test
Run an Electron app on Linux. Change something that is persisted in local storage. Exit the app, closing down Electron and restart (do not just refresh). Run in production because in development the path name is the path to index.html for the desktop app.
Review checklist
Reminder for reviewers