Skip to content

fix(desktop): force log refresh when reset or checkout moves HEAD - #214

Merged
devlint merged 3 commits into
mainfrom
fix/force-log-refresh-on-head-move
Oct 6, 2026
Merged

devlint merged 3 commits into
mainfrom
fix/force-log-refresh-on-head-move

Conversation

@t1gu1

@t1gu1 t1gu1 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Forces git log reloading when a reset or checkout operation moves HEAD, even if the top commit of an all-refs log remains unchanged. This ensures that branch and HEAD labels are immediately updated and accurately reflected in the Git tree.

Also, the switching branch/author filter or monorepo scope now fetches only the first
page and cancels the prefetch. A view epoch drops any in-flight page that
belongs to the old view.

Changes

  • Force a git log reload after reset and checkout operations in useCommitActions.
  • Update App.vue to handle the forced log refresh triggers.
  • Add unit tests in useCommitActions-refresh.test.ts to verify log reloading behavior when HEAD moves.

Test plan

  • Checkout an earlier commit or branch and verify HEAD and branch labels update immediately in the Git tree.
  • Reset HEAD to a previous commit and verify the HEAD pointer updates without manual reload.
  • Run automated tests to verify useCommitActions refresh behavior passes.

When resetting or checking out a commit, the top commit of an all-refs
log may not change if another ref remains on top. Force log reloading so
branch and HEAD labels update immediately in the Git tree.

🪄 Commit via GitWand
@t1gu1
t1gu1 requested a review from devlint October 6, 2026 03:20
@t1gu1

t1gu1 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

Fix that issue: #213

t1gu1 added 2 commits October 6, 2026 00:54
Switching branch/author filter or monorepo scope now fetches only the first
page and cancels the prefetch. A view epoch drops any in-flight page that
belongs to the old view.

🪄 Commit via GitWand
A forced reload refetched the whole prefetched log. Track the deepest
visible row from the graph and refetch only down to it plus a page;
the background prefetch refills the rest.

🪄 Commit via GitWand

@devlint devlint left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked locally: vue-tsc clean, 1614 desktop tests pass.

The root cause of #213 holds up: after a reset/checkout the all-refs log's top commit (origin/<branch>) doesn't move, so the unforced reload kept the stale log until the next poll. Forcing it, and capping the forced depth at the viewed row + one page instead of the whole prefetched history (up to 5000 commits), addresses both the staleness and the cost.

The view epoch looks right: stale pages are dropped in both loadLog and loadMoreLog, and logLoadingMore is only cleared by the fetch that owns it.

Non-blocking:

  • The epoch / forcedReloadDepth logic has no test; a small useGitRepo test for 'filter change during an in-flight page' would lock it in.
  • The view anchor is only reported by CommitGraph; from the list view a forced reload falls back to one page (fine, just noting).

@devlint
devlint merged commit 696fdbb into main Oct 6, 2026
9 checks passed
@devlint
devlint deleted the fix/force-log-refresh-on-head-move branch October 6, 2026 11:32
@devlint

devlint commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Thanks @t1gu1 — this one fixed #213 at the root: the forced reload after reset/checkout, plus capping its depth instead of refetching the whole prefetched history. The view epoch was a nice touch too. Shipped in v3.12.0, released today. 🙏

@devlint devlint mentioned this pull request Oct 6, 2026
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.

2 participants