Repository navigation
stop-redirecting-in-notification-bar automatically when possible - #3189
Conversation
Co-authored-by: Flo Edelmann <[email protected]>
| } | ||
|
|
||
| async function init(): Promise<void> { | ||
| // If the history length is `1` on init, the notification has been opened in a new tab |
There was a problem hiding this comment.
I think the variable name is self-explanatory, no comment needed.
There was a problem hiding this comment.
Hmm, disagree here... The key name in the line below is super hard to parse and understand.
sessionStorage.rghIsNewTab = history.length === 1;Also - I would like to explain my intent, in case our assumptions about the history.length are wrong and this leads to a bug in the future.
So I have updated the comment to add more background / motivation information: b935c60
There was a problem hiding this comment.
Although I would suggest keeping the comment, if for whatever reason this is not acceptable to have guiding comments in the codebase, then I can remove.
There was a problem hiding this comment.
The line says:
- we want to know whether the current tab is a new tab
- we expect to determine this by measuring
history.length
The comment says the same exact thing, in different words.
Comments are supposed to explain why you do something, not what you're doing bit by bit (unless it's a super complex line — which isn't the case)
stop-redirecting-in-notification-bar automatically when possible
|
This works great! Thanks Kaaaaarl |
|
No problem, thanks for the merge :) hehe ah Llamas with Hats, good one! Different languages can be funny too - eg. the German version is where I saw it first |
|
Thanks a lot @karlhorky, I end up using this all the time now 😊 |
|
@FloEdelmann great, glad you're happy, thanks for the input in the issue! |
Closes #3173
Feature originally implemented in #2952 and #3036.