Skip to content

fix(history): wait for the Files router before tagging its entries - #74

Merged
skjnldsv merged 1 commit into
mainfrom
fix/history-async-router
Oct 1, 2026
Merged

skjnldsv merged 1 commit into
mainfrom
fix/history-async-router

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

nextcloud/server#63954 fails "closing resets history so back does not re-open a file" since the Files app moved to vue-router 5 (nextcloud/server#61291). goToRoute() now lands the navigation asynchronously and resolves once the new entry exists, but pushToHistory() tagged the entry with its viewerPos right after asking for the push, so it tagged the previous entry. Closing then read an offset of 0, skipped the history.go(-offset), and back landed on an entry with openfile=true.

Every history change now waits for the router's navigation, queued behind the ones before it. goToRoute's type says it may return a promise, which the Files router has always done.

A new test has the router create its entry only after a delay, like vue-router 5: it fails on main with expected undefined to be 1 and passes here. The existing history tests wait for the queue. Not run against a real server here, the server PR's e2e will tell.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

Since the Files app moved to vue-router 5, goToRoute() lands the
navigation asynchronously and resolves once the new history entry
exists. The viewer tagged the entry with its offset straight after
asking for the push, so it tagged the previous one: closing then found
no viewer entries to unwind and back reopened the file.

Every history change now waits for the router's navigation, queued
behind the ones before it, so the offset goes on the entry the push made
and two quick navigations do not read each other's stale offset.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv skjnldsv added status: review Waiting for reviews type: bug 🐛 Something isn't working AI assisted labels Oct 1, 2026
@skjnldsv skjnldsv self-assigned this Oct 1, 2026
@skjnldsv skjnldsv added status: review Waiting for reviews type: bug 🐛 Something isn't working AI assisted labels Oct 1, 2026
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.10526% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.94%. Comparing base (babd3d0) to head (de10b9b).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lib/utils/history.ts 92.10% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   88.90%   88.94%   +0.03%     
==========================================
  Files          39       39              
  Lines        2776     2786      +10     
  Branches      574      576       +2     
==========================================
+ Hits         2468     2478      +10     
  Misses        301      301              
  Partials        7        7              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skjnldsv
skjnldsv merged commit 6f1cc78 into main Oct 1, 2026
20 checks passed
@skjnldsv
skjnldsv deleted the fix/history-async-router branch October 1, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted status: review Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant