-
Notifications
You must be signed in to change notification settings - Fork 52
Remember user preference for the visibility of the "about" panel #276
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 don't have a strong opinion about the name of the key.
I'm definitely against using LocalStorage for this so your choice of SessionStorage strikes me as more sensible. I have a genuine question here though: do we even need to use SessionStorage at all? Can't we simply store this info as a variable under sidebar
? I guess my question reveals that I don't really understand what SessionStorage is meant to be used for...
Overall, the PR looks good to me.
Well, it is true that this could be a good fit for using a variable instead of the SessionStorage. It can be modified quite easily if needed. Would you prefer me to use a variable instead of the SessionStorage? |
OK, thank you for the explanation. I don't have a strong opinion on it then and I think that others should chime in. AFAIK, we don't use SessionStorage anywhere else, which is why it made me wonder "what's so special about this case to warrant it?". We do use LocalStorage, for remembering the scroll positions of individual albums, and honestly that has always struck me as an odd choice (why should that be persistent?) and if it was up to me, I would covert that to SessionStorage (now that I know that there is this option 😄). |
Well in my opinion, it'd be pertinent to have this setting (the fact that the user wants to have the info sidebar open or not) being remembered even after refreshing but staying in the same tab (miss-clicks happen, but yeah it's just a button away so not a big deal). Really I don't have a strong opinion about the SessionStorage vs. variable situation, and it can be converted quite easily if needed. |
Personally, I would be in favor of a simple variable. :) |
I would use the I understand @kamil4 hesitations not to use |
Ok so:
|
I am also in favor of SessionStorage (assuming it get's wiped out once you restart your browser) :) |
Let's stick to SessionStorage then, especially since that's what the PR already does. Is it ready for merge? |
As stated here:
There's one case where it isn't reset when closing the browser I believe, when restoring a previous session (i.e when you set your browser to start from where you left off).
I'll re-read my code and check for potential bugs, just in case. Also I still haven't got any answer concerning the long variable name. Is it a good name, or should we use another one? ( |
Personally I would just go for |
I like @ildyria proposal more. Rationale: It starts with a verb and so matches the naming scheme. Also it makes clear that the variable is a boolean. If it all, then |
Okay, I totally agree with that, I'll change it |
Just changed the variable name, and the corresponding method in favor of |
…enerated or not, to store this preference in the sessionStorage of the user's browser Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
…ton_info, according to the last user's choice Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
…SidebarVisible Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
…ble() Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
ad6d0d0
to
100b01c
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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 fixed it so that it actually compiles after the latest changes and I rebased it on the current master. I also tested it. This should be good to go now.
Main goal
This PR brings an enhancement to the front-end: remembering if the user wants to have the "about" panel open or not.
Current behavior
i
keyAimed behavior
i
keyHow it is achieved
In this PR, a solution is proposed.
sidebar.toggle
method:is_user_initiated
SessionStorage
, so the status is Session-dependent, and is forgotten once the browser is closed. If needed it could be stored in theLocalStorage
, to keep it persistent after browser restarts.Things to discuss and TODOs
SessionStorage
orLocalStorage
?sidebarUserPreferenceVisible
a good name or not? And if not, what to choose?