mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-05 21:46:49 -04:00
When lazygit starts up in a repo with many remote branches, the pull request icons in the branches panel show up a good while after the branch list itself, even though the pull requests come from the cache file and are in the model before the first render. In the repo where this showed up (5400 remote branches) the icons were up to half a second late. The icons are rendered from Model.PullRequestsMap, and that map is built from the remotes' URLs, because a branch's upstream remote tells us which repo owner's pull requests to look for. The map therefore stays empty until the remotes are in the model, and the remotes refresh doesn't put them there until it has also enumerated and sorted all remote branches. In a big repo that takes hundreds of milliseconds; reading the remotes themselves takes ten. Load the two separately, and put the remotes in the model as soon as they have been read from the git config. The branches refresh then finds them there, and the pull request icons are part of the first render of the branch list. Carry over the branches of the remotes we already have in the model in that first update, so that the remote branches, and the branch counts in the remotes panel, stay in place until the fresh ones are loaded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>