Skip to content

fix(native): read git every second and when a card is selected - #921

Merged
omartelo merged 1 commit into
mainfrom
fix/native-git-refresh-lag
Oct 23, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/native-git-refresh-lag

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

What

The native window re-read each card's checkout every 3 seconds, and only then. A commit, checkout or edit made outside a turn (in a terminal, say) took up to 3s to show on the card and the footer. The pull request badge waited for that tick before asking gh, so after a commit it lagged up to about 3.6s. Selecting a card showed whatever the last tick had found.

The backend was not the bottleneck. Measured against a running 0.78.0 backend, project.Diff answers in 3-35ms per checkout and project.BaseStatus in 1-2ms. A full tick over six open checkouts stays under 70ms.

How

  • gitPoll goes from 3s to 1s (native/cmd/lich-native/model.go). gh is asked no more often than before: the pull request is looked up again only when the branch or head moves, or on prRecheck.
  • setActive, the one path every card switch goes through (click, hotkey, layout), reads the selected card's checkout at once with refreshPath.

Tests

  • TestSelectingACardReadsItsGitWithoutATick: selecting a card reads the new head without a tick. It fails without the fix.
  • fakeUnread in cardstate_test.go now answers the git reads, because setActive makes them (the contract changed). No assertion changed.

Local gate from native/: gofmt -l . clean, go vet ./... clean, go test ./... green. The selection, unread and session-touched tests also ran green at -count=50. Nothing outside native/ changed besides CHANGELOG.md, so the backend suite was not run. No OS seam touched.

CHANGELOG.md [Unreleased] › Fixed has an entry. Provider parity: this is window-side git polling, the same for every provider.

@omartelo
omartelo merged commit e26efe3 into main Oct 23, 2026
7 checks passed
@omartelo
omartelo deleted the fix/native-git-refresh-lag branch October 23, 2026 14:38
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.

1 participant