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 delay when cmd tabbing into GitUp #993

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

lapfelix
Copy link
Contributor

So NSApplicationDidBecomeActiveNotification isn't blocked so command-tabbing into GitUp isn't delayed because we're refreshing all the repositories synchronously. The work will still be done on the main thread, but it will now be less likely to be noticed (especially with Stage Manager activated, the reload will probably be done by the time the Stage Manager animation is done)

Steps to reproduce the problem before:

  1. Open several big repositories
  2. Switch to the Finder or any other app
  3. cmd tab back into GitUp

Before:
Takes 1-2 seconds before macOS actually switches to GitUp.

With the async dispatch:
macOS instantly switches to GitUp, but the app is unresponsive for 1-2 seconds.

I AGREE TO THE GITUP CONTRIBUTOR LICENSE AGREEMENT

So `NSApplicationDidBecomeActiveNotification` isn't blocked so command-tabbing into GitUp isn't delayed because we're refreshing all the repositories synchronously. The work will still be done on the main thread, but it will now be less likely to be noticed (especially with Stage Manager activated, the reload will probably be done by the time the Stage Manager animation is done)
@lapfelix lapfelix changed the title Move the contents of _didBecomeActive into a main queue async dispatch Fix delay when cmd tabbing into GitUp Apr 16, 2024
@Cykelero
Copy link
Contributor

Just wanted to say—that's a really clever fix! A pretty big difference in UX for very little code change :)

@lucasderraugh
Copy link
Collaborator

Seems like a reasonable tradeoff.

@lucasderraugh lucasderraugh merged commit db2e97f into git-up:master Apr 22, 2024
@lapfelix lapfelix deleted the fix-cmd-tab-delay branch April 22, 2024 20:09
@drewvolz
Copy link

Thank you so much @lapfelix, this fixed the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants