Bug fix button#137
Conversation
* Fix the loading state by removing display: flex !important * add display: flex * Change style.display from block to flex * Update docs/script.js Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Max Base <MaxBaseCode@Gmail.Com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary of ChangesHello @NssGourav, 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 with the 'I'm Feeling Lucky' button, ensuring it functions as expected by accurately selecting and highlighting a random user from the currently displayed and sorted list. The changes improve the reliability of this feature by updating the underlying data source for user selection and refining the DOM manipulation for highlighting, providing a more consistent user experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 successfully addresses the bug with the "I'm Feeling Lucky" button by correctly using the filtered and sorted list of users. The change to query the DOM for the user's card instead of relying on a pre-existing property makes the implementation more robust. I've identified a high-severity race condition in the new highlighting logic that could lead to multiple cards being highlighted at once and have provided a suggestion to resolve it.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request successfully fixes the "I'm Feeling Lucky" button bug by correctly using the filtered and sorted user data. The changes also improve the highlighting logic by querying the DOM for the user card and clearing any previous highlights, making it more robust. I've included a couple of minor suggestions to improve code style and simplify a new helper function.
|
@BaseMax please review |
jbampton
left a comment
There was a problem hiding this comment.
If we are only updating JS code why do we need to delete avatars ?
yeah to resolve merge conflicts that has been done else it's not req to delete |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly aims to fix the "I'm Feeling Lucky" button by using the filtered and sorted list of users. The new getVisibleSortedUsers function is a good addition. However, I've found a few critical issues that will prevent this from working as intended. I've added a specific comment for a bug introduced in the diff. Additionally, there are two other issues to address:
- The variable
usersToPickFromis used on lines 72 and 73 but is no longer defined. It should be replaced withvisibleSortedUsers. - There seems to be a pre-existing issue where
randomUser.cardis alwaysundefinedbecause the card element is never assigned to the user object. You may need to adduser.card = card;in therenderCardsfunction for the highlighting to work.
Fixing these issues should make the feature fully functional.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request aims to fix a bug in the "I'm Feeling Lucky" button by ensuring it uses the correctly filtered and sorted list of users. The introduction of the getVisibleSortedUsers function is a good step towards this. However, the implementation in pickRandomUser has a critical bug where a variable was renamed, but not all its usages were updated, which will lead to a runtime error. I've provided a suggestion to fix this.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Did you test this locally ? |
|
For me the button does not work |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request successfully fixes the 'I'm Feeling Lucky' button by ensuring it selects a random user from the correctly filtered and sorted list. The added fallback logic for finding user cards and caching them on creation are great improvements for robustness and performance. I've included a couple of suggestions to further improve the code by refactoring duplicated logic and removing a potentially problematic try...catch block. Overall, this is a solid contribution that addresses the bug effectively.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request fixes the 'I'm Feeling Lucky' button by correctly using the filtered and sorted user data, which is a great improvement. The logic is now much more robust.
I have a couple of suggestions to further improve the code:
- I've pointed out a potential issue with stale DOM references that could lead to a silent failure. A small addition can make the feature even more robust.
- I also noticed some code duplication for showing toast notifications, and I've suggested refactoring it into a helper function to improve maintainability.
Overall, these are solid changes that fix the reported bug. Addressing my comments will make the code even better.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Can you please run pre-commit on your branch and push? |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the user selection logic in docs/script.js to enhance robustness and maintainability. The pickRandomUser function now utilizes a new getVisibleSortedUsers helper to ensure it selects from the currently filtered and sorted list of users. A significant improvement was added to pickRandomUser to handle scenarios where a user's card might not be directly available or connected to the DOM; it now includes a fallback search by data-login and displays a toast notification if the card remains unlocatable. Furthermore, the buildCardElement function was updated to store the created card directly on the user object for more efficient access. A review comment highlighted code duplication in docs/script.js regarding the toast notification logic, suggesting its extraction into a reusable helper function. Additionally, across fetch.py and render.py, all f-string logging statements were converted to use standard string formatting for consistency.
| const msg = document.createElement('div'); | ||
| msg.className = 'toast-notification'; | ||
| msg.textContent = '🎲 Could not locate the selected developer card. Try again.'; | ||
| document.body.appendChild(msg); | ||
| setTimeout(() => msg.remove(), 3000); | ||
| return; |
There was a problem hiding this comment.
This block of code for creating a toast notification is very similar to the one on lines 62-66. To avoid code duplication and improve maintainability, you could extract this logic into a helper function. For example:
function showToast(message) {
const msg = document.createElement('div');
msg.className = 'toast-notification';
msg.textContent = message;
document.body.appendChild(msg);
setTimeout(() => msg.remove(), 3000);
}You could then call showToast('🎲 Could not locate the selected developer card. Try again.'); here and showToast('🎲 No developers found! Try adjusting your filters.'); on line 64.
|
It's long time we missed the functionality while we have the "random" button on the production site. it's not good. |
- Created showToast() helper function to avoid code duplication - Replaced duplicate toast notification code in pickRandomUser() - Improves maintainability and follows DRY principle
Agreed this has been broken too long. I’ll prioritize and ship a fix for the random button right now |
|
Yes I am checking, but please double check everything on your end and give me your final feedback here. I want to merge it sooner, so I can continue developing the project tonight. Best and Happy Yalda night. |
All pre-commit checks pass on my end and I’ve incorporated the Gemini suggestions. Ready to merge |




Bug in "🎲 I'm Feeling Lucky" button - seems not working for me here #118