Skip to content
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

Prefix local storage access with user email address #4217

Merged
merged 5 commits into from
Aug 7, 2019

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Aug 2, 2019

According to main.js, the entire rendering of views is blocked by loading the active user. So, simply depending on the store synchronously should work pretty well. For the layouts, my testing showed that everything works as expected, except for logging in on a tracing page without reloading. One could expect that the layout is changed automatically (to the last layout used by the logged in user). However, the layout code itself is quite brittle which is why I didn't want to touch that. Also, the impact isn't really big. What happens now is that the layout stays the same, but after reloading the last active layout (by the user) is loaded again.

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • change the layout while being logged in (and off)
  • log in / out and check that the layouts are persisted

Issues:


@philippotto philippotto self-assigned this Aug 2, 2019
Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice implementation :)

frontend/javascripts/libs/user_local_storage.js Outdated Show resolved Hide resolved
frontend/javascripts/libs/user_local_storage.js Outdated Show resolved Hide resolved
frontend/javascripts/libs/user_local_storage.js Outdated Show resolved Hide resolved
},

removeItem(key: string): void {
return localStorage.removeItem(key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also use prefixKey(key)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, well spotted! 👍

@philippotto
Copy link
Member Author

Thanks for your review and the commit suggestions 👍 Should be ready now :)

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bulldozer-boy bulldozer-boy bot merged commit 74c95a6 into master Aug 7, 2019
@bulldozer-boy bulldozer-boy bot deleted the prefix-localstorage branch August 7, 2019 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure all localstorage keys depend on user name
2 participants