-
Notifications
You must be signed in to change notification settings - Fork 13
Fix UI lag during taskspace deletion by making operations async #35
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 UI lag during taskspace deletion by making operations async #35
Conversation
- Made deleteTaskspace function async to prevent blocking main thread - Wrapped git operations (worktree removal, branch deletion) in background task - Updated UI calls to use MainActor for thread-safe state updates - Prevents app hanging during delete operations Co-authored-by: Claude <claude@anthropic.com>
- Added executeProcessAsync() that runs git commands in detached tasks - Replaced synchronous executeProcess calls in deleteTaskspace - Now waitUntilExit() runs off main thread completely - Further improves UI responsiveness during delete operations Co-authored-by: Claude <claude@anthropic.com>
- Replaced computed branchInfo property with cached state - Load branch info asynchronously on dialog appear - Prevents multiple git commands on every UI refresh - Eliminates lag when clicking delete branch checkbox Co-authored-by: Claude <claude@anthropic.com>
7f8c361 to
fe291f9
Compare
|
I've added a cache for the git info, but it's only while the dialog is live, not the entire application window. |
- Shows progress spinner and 'Checking branch status...' text - Improves UX by indicating async operation in progress - Hides loading state once branch info is cached Co-authored-by: Claude <claude@anthropic.com>
fe291f9 to
41cb416
Compare
nikomatsakis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! I had noticed that UI is very slow but hadn't read carefully into it.
| }.value | ||
|
|
||
| // Set default deleteBranch toggle based on safety analysis | ||
| deleteBranch = (cachedBranchInfo.unmergedCommits == 0 && !cachedBranchInfo.hasUncommittedChanges) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess what happens is that, initially, the cached branch name is empty, so the user sees no checkbox at all, but then it appears some time later once the git command has completed? I think it'd be nice if we displayed a message like "...determining github branch information..." to keep them up-to-date.
| .multilineTextAlignment(.center) | ||
|
|
||
| if !cachedBranchInfo.branchName.isEmpty { | ||
| if isLoadingBranchInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...lol, I guess you anticipated my request...
Deleting taskspaces caused main UI thread to hang. This makes a bunch of stuff in that flow async, preventing this issue.