Skip to content
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

fix: handle no active tab scenarios #164

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

BelKed
Copy link
Contributor

@BelKed BelKed commented Feb 27, 2025


Important

getActiveWindowTab in helpers.ts now checks all windows for active tabs and logs when none are found.

  • Behavior:
    • getActiveWindowTab in helpers.ts now handles scenarios with no active tab in the current window by checking all windows.
    • Returns undefined if no active tab is found in any window.
    • Adds debug logs for cases with no active tab in current or any window.

This description was created by Ellipsis for 43f8617. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 43f8617 in 30 seconds

More details
  • Looked at 40 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 drafted comments based on config settings.
1. src/background/helpers.ts:9
  • Draft comment:
    Good use of async/await for handling asynchronous tab queries. The fallback logic is clear.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. src/background/helpers.ts:19
  • Draft comment:
    Consider if debug logging here is sufficient or if users should be notified.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. src/background/helpers.ts:21
  • Draft comment:
    Fallback query to search for active tabs in any window works well to address the issue.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
4. src/background/helpers.ts:29
  • Draft comment:
    Final debug log and returning undefined if no active tab exists: behavior meets the requirement.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
5. src/background/helpers.ts:9
  • Draft comment:
    Ensure downstream code handles undefined return value, as getActiveWindowTab now returns undefined instead of throwing.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
6. src/background/helpers.ts:9
  • Draft comment:
    Consider adding an explicit return type annotation (e.g. Promise<browser.tabs.Tab | undefined>) for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
7. src/background/helpers.ts:21
  • Draft comment:
    Double-check that falling back to any active tab across windows is the desired behavior; it might result in selecting a non-current window's tab.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_Yd8wPikvM0Qg5wKm


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

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

This seems good to me, merging for now.

Let me know if you're feeling confident and I'll make a new release :)

@ErikBjare ErikBjare merged commit b3dfcb1 into ActivityWatch:master Feb 28, 2025
5 checks passed
@BelKed
Copy link
Contributor Author

BelKed commented Feb 28, 2025

@ErikBjare I'm pretty sure this will fix the issue, so I agree with creating a new release :)

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.

Setting custom browser name doesn't work. Version 5 takes inaccurate readings
2 participants