Repository navigation
fix(web-panel): closing a docked file or a page after a reload goes back under every page entry - #3095
Conversation
…ack under every page entry (#3058) A docked file that takes over a stacked page's entry keeps the count of the web panel's entries under it, so closing the file goes back past them. A phone sheet's entry left as an ordinary one (reload, Forward onto a retired entry, an address changed on it) that copied a page's entry counts as one more of the page's, so Close page goes back past it.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait...
|
…py of that entry, keep the page count Review of #3095: releaseFile kept dropping the count before a web page took the file's entry over, and a sheet's copy of a file entry holding the count was not counted as one more.
…e file that takes it Review of #3095 (omo, reproduced): a diff pushed over a docked file holding the count copied it, and the diff's file replacing that entry closed past file A onto a page.
|
Review notes for d0a9d3a. omo: CLEAR on 3b31444. On b5bd13d: BLOCK for one reproduced MEDIUM this PR introduced (a diff pushed over a docked file copied the page count, so the diff's file closed past file A onto a page). Fixed in d0a9d3a ( Codex (Terra 6.1, xhigh), round 1: two MEDIUMs, both fixed in b5bd13d with failing-first checks:
Codex on d0a9d3a: no HIGH, no MEDIUM introduced by the PR. Codex round 2 (no HIGH), left after the one fix round:
|
|
Local merge gate (owner-approved): origin/main merged (no overlap), |
…heet goes back to the pane (#3115) Fixes #3101 ## What On a phone, a sheet (the command palette, the ⋯ menu) is a history entry that copies the entry it opened over. On reload `lib/sheetHistory.ts` turned that entry into an ordinary one by dropping only the sheet's own mark. Over a plain file, the copy kept `ovis:file-preview`, so it read as a second entry of the file above the real one: closing the file (X) went back one entry, landed on the real file entry, and the viewer came back. A repository diff had the same problem. #3095 already counts such a copy for the web panel: a copy of a page's entry is one more of the page's (`ovis:web-panel-below`), and Close page goes back past it. This PR applies the same rule to a file's and a diff's own entry: - `overCopiedWebPanel` becomes `overCopiedEntry` (`lib/historyKeys.ts`). A copy of an entry that holds `ovis:file-preview` or `ovis:repo-diff` now also gets the count, so the copy holds one more entry under it. A file's or a diff's copy counts only where the entry under it is still the one it copied: a reload, and an address an item changed on the sheet's entry. Forward onto a retired sheet entry keeps main's rule, which counts only the web panel's copies. After Back, another pane may have taken over the entry under it (review round). - `closeFile` already goes back `1 + below`. `closeDiff` now does the same through `backUnderCurrentEntry`, in place of a single `history.back()`. If the browser refuses the traversal, the closing latch is released, as `closeFile` already does. - `ovis:file-preview` and `ovis:repo-diff` now live in `historyKeys.ts` with the other shared history keys, so `sheetHistory` can recognise them without importing the viewers. Back still steps through the entries one at a time, as before (#3095). Pushes already drop the count where needed: `openFile` pushes through `withoutWebPanel`, `openDiff` drops it, and a web page pushed from the palette sets it to 0. So a fresh entry pushed over a copy never inherits the count. A file or diff that replaces the copy's entry keeps the count, so it still closes past both entries. ## Design This follows the rule #3058/#3095 set, which a browser tab also follows: closing drops everything the overlay holds, while Back walks through it. Nothing changes on screen, and there is no new setting. ## Validation - Failing first, on origin/main 72b8127: - `scripts/files-documents-demo-regression.ts`, phone branch, new step (Documents → a file as the popup viewer, palette over it, reload, Close file): `closing the file after a reload under the palette goes back to the pane's entry (0), not 1`. It passes with the fix at 390 light and dark, and the 1280 steps pass too. - `src/lib/sheetHistory.test.ts`, new test: a sheet's copy of a plain file's or a diff's entry that is kept over it counts one more under it, and a copy that Forward lands on after Back does not. Reverting either side of the change turns it red. - `src/lib/useFilePanels.hook.test.ts`, new test: a diff over a copy of its entry closes back to the pane. Without the change it traverses onto the diff's own entry. It passes with the change. - Unit: `sheetHistory`, `useFilePanels*`, `repoDiff`, `useFileViewer`, `webPanel` and `settingsHistory` tests pass (54 + 38). Running `settingsHistory.test.ts` in the same process as `sheetHistory.test.ts` fails 6 settings tests on origin/main as well, because the files interfere with each other. Each file passes on its own. - `bun run typecheck`: pass. - In the CI runner image (`herdr-ci-runner:local`, uid 1001): files-documents, files-panel, palette-local-page, web-panel-mobile, file-viewer-mobile, diff-find and diff-line-notes regressions pass, and so does `repo-diff-browser-qa.ts` (Back/Close/focus of the diff). `phone-worktree-sheet-regression.ts` times out waiting for a response on origin/main in the image too, because it needs an owned herdr pane. It is not affected by this change. - `bun run check fast`: pass (12585 unit tests, 0 fail; typecheck, build, generated files). - After the review round: `bun run check fast` passes again, and so do the files-documents and palette-local-page regressions. - Skipped: `bun run check full` (CI runs the integration and browser lanes).

Fixes #3058
What
Both cases are on a phone (or a window that widens from one) with Settings → Web links set to In the app, follow-ups of #3057.
withoutWebPaneldropped theovis:web-panel-belowcount with the page's marks. Closing the file went back one entry and the first page showed again. NowuseFileViewer.openFilekeeps that count when it replaces an entry (a fresh push never carries one),closeFilegoes back1 + belowentries, andreleaseFilekeeps the count, so a page that takes the docked file's entry over (a web link opened beside the pane) still goes back past the pages.lib/sheetHistory.tsstripped only the sheet mark, leaving a second page entry over the real one, so Close page landed on the real one and the page came back. Now an entry a sheet leaves as an ordinary one (reload, Forward onto a retired entry, an address changed on it) counts, when it copied a page's entry (or a docked file's entry holding the count), as one more of the page's (overCopiedWebPanelinlib/historyKeys.ts), and Close page goes back past it in the same traversal.A diff pushed over such a docked file no longer copies the count (
useRepoDiffViewer.openDiff), so the diff's file that takes the diff's entry over closes onto the file under it, not past it.Back still walks the entries one at a time, as before.
Design
Same rule as #3057 and a browser tab: closing drops everything the panel holds, Back walks through it. No new setting, no UI change.
Not changed
presentFile/openDiffFilestep back a fixed two entries when a popup file or a diff's file docks over a report that holds the entry; over a stacked report they would still land on an earlier page. Not reproduced here, left as is.Validation
scripts/palette-local-page-demo-regression.ts(phone branch, two new steps): on origin/main 1427e1c the reload step failed (Close page after a reload under the palette goes back to the pane's entry); with that fixed, the docked file step failed (closing a file docked over two pages goes back to the pane's entry). Both pass with the fix at 390 and 1280, light and dark.releaseFile), and a retired copy of a file entry holding the count (unit assertion). Both pass.src/lib/useFilePanels.hook.test.ts(a diff's file docked over a file holding the count closes onto that file) fails without theuseRepoDiffViewer.tschange (traverses to the page) and passes with it.src/lib/sheetHistory.test.ts(a retired entry copied from a page's counts one more) fails without thesheetHistory.tschange and passes with it;sheetHistory,useFilePanels*andwebPaneltests pass.file-viewer-regression.tstimes out on.conn-livein the image on origin/main too (it needs an owned herdr pane), so not from this change.bun run check faston the head after merging origin/main: pass (12527 unit tests, 0 fail; typecheck, build, generated files).bun run check full(CI runs integration and browser lanes).