fix profile loading#109
Conversation
|
@fariqueparammel is attempting to deploy a commit to the lamsta Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @fariqueparammel, 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 resolves an issue where the UI would freeze when clicking the 'View Profile' button in the GitHub modal. By implementing a loading state and a visual spinner, the change provides immediate feedback to the user during page navigation, significantly enhancing the perceived responsiveness and overall user experience. 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.
Code Review
This pull request effectively resolves a UI freeze by introducing a loading state during profile page navigation. The implementation is clean and directly addresses the issue. My review includes a minor suggestion to optimize the new function definition, aligning it with React best practices for performance and consistency already present in the component.
| const redirectToProfilePage = async () => { | ||
| if (!profile) return; | ||
| setLoading(true); | ||
| await router.push(`/${profile?.login}?ref=modal`); | ||
|
|
||
| // no need to setLoading(false) because navigation will replace this page | ||
| }; |
There was a problem hiding this comment.
This function is redefined on every render. To optimize performance and maintain consistency with other memoized callbacks in this component (e.g., validateGithubUsername), you should wrap redirectToProfilePage in useCallback.
Also, the optional chaining in profile?.login is redundant due to the if (!profile) check above it. Removing it will make the code slightly cleaner.
| const redirectToProfilePage = async () => { | |
| if (!profile) return; | |
| setLoading(true); | |
| await router.push(`/${profile?.login}?ref=modal`); | |
| // no need to setLoading(false) because navigation will replace this page | |
| }; | |
| const redirectToProfilePage = useCallback(async () => { | |
| if (!profile) return; | |
| setLoading(true); | |
| await router.push(`/${profile.login}?ref=modal`); | |
| // no need to setLoading(false) because navigation will replace this page | |
| }, [profile, router]); |
Summary
View profile buttong used to freeze till next page is being reloaded. So, added a function to show loading animation till the new page is loaded.
Description
fix profile loading by adding a new function to show loading animation while its being redirected
Motivation and Context
immediate fix for indiafoss 2025
How has this been tested?
manually tested.
Screenshots (if appropriate):
Types of changes
Checklist: