Skip to content

repoList closing properly now #198

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

Merged
merged 6 commits into from
Jul 15, 2025
Merged

repoList closing properly now #198

merged 6 commits into from
Jul 15, 2025

Conversation

vedansh-5
Copy link
Contributor

@vedansh-5 vedansh-5 commented Jul 12, 2025

📌 Fixes

Fixes # (Use "Fixes", "Closes", or "Resolves" for automatic closing)


📝 Summary of Changes

Repo List closes properly now


📸 Screenshots / Demo (if UI-related)

repoList.mp4

✅ Checklist

  • I’ve tested my changes locally
  • I’ve added tests (if applicable)
  • I’ve updated documentation (if applicable)
  • My code follows the project’s code style guidelines

👀 Reviewer Notes

Add any special notes for the reviewer here

Summary by Sourcery

Ensure the repository filter UI properly hides and the dropdown closes when toggled without a GitHub token, and auto-dismiss the token warning after a delay.

Bug Fixes:

  • Guard against missing repoFilterContainer to prevent runtime errors.
  • Hide the repo filter container and close the dropdown when the filter is enabled without a token, and persist the disabled state.
  • Auto-dismiss the token warning message after 4 seconds.

Signed-off-by: Vedansh Saini <77830698+vedansh-5@users.noreply.github.com>
Copy link
Contributor

sourcery-ai bot commented Jul 12, 2025

Reviewer's Guide

Improve repo filter behavior by ensuring the filter UI closes and hideDropdown is invoked when no token is present, and auto-hide the token warning after a brief delay.

Sequence diagram for repo filter closing when no token is present

sequenceDiagram
    actor User
    participant UI as Repo Filter UI
    participant Storage as chrome.storage.local
    participant Dropdown as hideDropdown()
    User->>UI: Enable repo filter
    UI->>UI: Check for GitHub token
    alt No token present
        UI->>UI: Uncheck repo filter
        UI->>UI: Hide repo filter container
        UI->>Dropdown: Call hideDropdown()
        UI->>Storage: Set useRepoFilter to false
        UI->>UI: Show token warning
        UI->>UI: Auto-hide warning after 4s
    end
Loading

File-Level Changes

Change Details Files
Enhance repo filter no-token handling
  • Include repoFilterContainer in the DOM-ready guard
  • On init with filter enabled but no token: uncheck filter, hide container, call hideDropdown, and persist change
  • In dropdown logic: explicitly hide container and invoke hideDropdown when token is missing
src/scripts/popup.js
Auto-hide token warning
  • Add a 4-second timeout to re-hide the token warning
src/scripts/popup.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@vedansh-5 vedansh-5 self-assigned this Jul 12, 2025
@vedansh-5 vedansh-5 requested a review from Preeti9764 July 12, 2025 20:10
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @vedansh-5 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vedansh-5 vedansh-5 marked this pull request as draft July 12, 2025 20:13
Signed-off-by: Vedansh Saini <77830698+vedansh-5@users.noreply.github.com>
Signed-off-by: Vedansh Saini <77830698+vedansh-5@users.noreply.github.com>
@vedansh-5 vedansh-5 marked this pull request as ready for review July 12, 2025 20:20
@vedansh-5 vedansh-5 requested a review from hpdang July 12, 2025 20:21
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @vedansh-5 - I've reviewed your changes - here's some feedback:

  • The hide repoFilterContainer and hideDropdown logic is duplicated in multiple places — extract into a helper to keep the behavior consistent.
  • repoFilterContainer is only queried in the first block, so it’s undefined in the later listener; move its selection into a shared scope or re-select it where needed.
  • Consider clearing any existing tokenWarning timeout before setting a new setTimeout to prevent overlapping hides if the user toggles the filter rapidly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The hide repoFilterContainer and hideDropdown logic is duplicated in multiple places — extract into a helper to keep the behavior consistent.
- repoFilterContainer is only queried in the first block, so it’s undefined in the later listener; move its selection into a shared scope or re-select it where needed.
- Consider clearing any existing tokenWarning timeout before setting a new setTimeout to prevent overlapping hides if the user toggles the filter rapidly.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Signed-off-by: Vedansh Saini <77830698+vedansh-5@users.noreply.github.com>
@hpdang
Copy link
Member

hpdang commented Jul 13, 2025

@Preeti9764 please test this

Signed-off-by: Vedansh Saini <77830698+vedansh-5@users.noreply.github.com>
@Preeti9764
Copy link
Contributor

Preeti9764 commented Jul 14, 2025

@vedansh-5 i found it is showing 3 repos for last one day please look into this and this is in master branch also please resolve this repo filter bug as it shows last stored repos no. and doesn't shows repos on basis of date selected now, as you have applied gets updated on switching the date ranges.Thanks!

repo.bug.mp4

@vedansh-5
Copy link
Contributor Author

@vedansh-5 i found it is showing 3 repos for last one day please look into this and this is in master branch also please resolve this repo filter bug as it shows last stored repos no. and doesn't shows repos on basis of date selected now, as you have applied gets updated on switching the date ranges.Thanks!

repo.bug.mp4

This is not a bug, Preeti. You disabled the checkbox before changing the dates - that means the new repo list won’t be fetched when dates are changed because the feature is disabled. This is the intended behavior - we do not want unnecessary fetch requests when the extension is turned off, especially if there’s no token.
The repos are fetched properly for the selected dates when the checkbox is enabled.
If you’re implying that we should make a new fetch request every time the checkbox is toggled on or off, that is not the solution. If we check whether the data is fresh each time the extension is enabled, we still have to make a fetch call anyway - which defeats the point of disabling it.
I have changed the helper box to take care of such cases for the user.
image
Thanks!

Signed-off-by: Vedansh Saini <77830698+vedansh-5@users.noreply.github.com>
@hpdang hpdang merged commit b28cdf4 into fossasia:master Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants