Fix: Discard Changes no longer pauses when window loses focus#21739
Merged
niik merged 2 commits intodevelopmentfrom Mar 5, 2026
Merged
Fix: Discard Changes no longer pauses when window loses focus#21739niik merged 2 commits intodevelopmentfrom
niik merged 2 commits intodevelopmentfrom
Conversation
…op in discardChanges The queueWorkHigh utility used requestAnimationFrame to spread synchronous moveItemToTrash work across frames. Since moveItemToTrash is now async, this is no longer necessary — and the use of requestAnimationFrame caused the discard loop to stall whenever the window lost focus (energy-saving behavior). Replace the queueWorkHigh call in GitStore.discardChanges with a simple for...of + await loop, and remove the now-unused queue-work.ts file. Co-authored-by: niik <634063+niik@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix discard changes functionality when window is inactive
Fix: Discard Changes no longer pauses when window loses focus
Mar 5, 2026
niik
approved these changes
Mar 5, 2026
sergiou87
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discarding a large set of files would stall whenever the user switched away from the Desktop window, because the per-file work was scheduled via
requestAnimationFrame— which Electron/browsers throttle to 0 fps on blur.queueWorkHighwas introduced whenmoveItemToTrashwas synchronous and blocked the render loop. That API is now async, so the animation-frame queue buys nothing and only introduces the focus dependency.Description
git-store.ts: ReplacequeueWorkHigh(files, async file => { … })with a plainfor…ofloop. Eachawait this.shell.moveItemToTrash(…)call is already non-blocking; no frame-budget coordination needed.queue-work.ts: Delete. No remaining callers.Screenshots
N/A – no UI changes.
Release notes
Notes: [Fixed] Discard Changes now completes even when the GitHub Desktop window is not focused
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
electronjs.org/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/lib/node_modules/npm/bin/node-gyp-bin/../../node_modules/node-gyp/bin/node-gyp.js rebuild(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.