-
Notifications
You must be signed in to change notification settings - Fork 42
[WIP] Fix OSPP PR bugs #106
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chen Su <[email protected]>
Signed-off-by: Chen Su <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary of ChangesHello @ghosind, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses several identified bugs from OSPP projects, focusing on improving the overall user experience and system robustness. It streamlines user authentication-related flows, particularly around logout and user identification, and enhances the internationalization setup to better manage language preferences. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request aims to fix bugs and improve the application's robustness. The changes to enhance user name extraction from JWTs and to make language settings more persistent using cookies are well-implemented. However, the logout functionality in UserMenu.tsx uses localStorage.clear(), which is overly aggressive and can lead to unintended side effects. I've provided a specific comment with a code suggestion to refine the logout process, making it safer and more precise.
| localStorage.clear(); | ||
| setStoredToken(''); | ||
| setCookie(''); |
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.
Using localStorage.clear() is overly broad and can lead to unintended side effects, like clearing user preferences. It's better to specifically clear the data related to the user session. Additionally, setCookie('') doesn't delete the cookie; it only empties its value.
A better approach is to set the token and cookie values to null. This will be handled by your custom hooks to properly clear the session data. Note that a type cast is needed for setCookie due to its current restrictive type signature.
| localStorage.clear(); | |
| setStoredToken(''); | |
| setCookie(''); | |
| setStoredToken(null); | |
| (setCookie as any)(null); |
Signed-off-by: Chen Su <[email protected]>
Signed-off-by: Chen Su <[email protected]>
Signed-off-by: Chen Su <[email protected]>
Signed-off-by: Chen Su <[email protected]>
Signed-off-by: Chen Su <[email protected]>
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR is for fixing the bugs from the OSPP projects and removing duplicate code.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: