Skip to content

fix(viewerAction): replace the history entry when closing the viewer - #3331

Open
ELHart05 wants to merge 2 commits into
nextcloud:masterfrom
ELHart05:fix/viewer-close-history-entry
Open

fix(viewerAction): replace the history entry when closing the viewer#3331
ELHart05 wants to merge 2 commits into
nextcloud:masterfrom
ELHart05:fix/viewer-close-history-entry

Conversation

@ELHart05

Copy link
Copy Markdown

Summary

pushToHistory opens a file by replacing the folder's history entry with one that carries openfile, but onClose pushes a new entry instead of replacing it. The entry carrying openfile is left behind, so after closing a file, going back reopens the file you just closed rather than leaving the folder. Pressing back again bounces between the leftover editing=false entries, because the viewer keeps pushing while you are navigating backwards.

Steps, on 34.0.2:

  1. Open a folder containing an image or a PDF
  2. Open the file, then close it with the X
  3. Press the browser back button

Expected: you leave the folder. Actual: the viewer reopens.

Closing now replaces the current entry, which mirrors what opening does and leaves the history exactly as it was before the file was opened.

Added a case to playwright/e2e/navigation.spec.ts next to the existing back-button test. It fails without the change.

Needs /compile before merging.

Opening a file replaces the folder's history entry with one that carries
`openfile`. Closing pushed a new entry on top of it instead of replacing it,
so the entry carrying `openfile` was left behind: going back after closing
reopened the file that had just been closed instead of leaving the folder,
and further back navigation bounced between the leftover entries.

Closing now replaces the current entry, mirroring what opening does.

Signed-off-by: ELHart05 <o.allaoua@esi-sba.dz>
@ELHart05
ELHart05 force-pushed the fix/viewer-close-history-entry branch from bf0051a to 3cc0d2e Compare August 12, 2026 16:12
Signed-off-by: ELHart05 <o.allaoua@esi-sba.dz>
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