Repository navigation
fix(shortcuts): sync overrides across browser tabs - #1827
Merged
Merged
Conversation
Refresh shortcut overrides in mounted settings consumers when another tab changes local storage. Preserve unrelated settings and avoid writing the incoming change back. Refs #1179
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Owner
Author
|
Merge pass: review-work report. Overall: PASSED.
Manual QA
Code review
Gate review
Follow-ups (MINOR)
All required checks are green and no review thread is open. CodeRabbit did not review this PR (rate-limited). The gate review above stands in for it. |
devswha
added a commit
that referenced
this pull request
Oct 28, 2026
…name (#1179) (#2187) ## What it does Settings → Phone & devices → Devices keeps the "This device" badge in one piece beside a device's name on a phone. Before, at 390 px the pill beside "iPhone · Safari" broke between its two words: "THIS" at the end of the name's line and "DEVICE" on the next (#1179, item 1). ## Why `.devices-current` was a plain inline span, so the line breaker split it like any text. It is now `display: inline-block`: an atomic inline box is never split across lines, so beside a name that fills the line it moves to the next line whole. Its own words still wrap inside it when the column is narrower than the pill (a 320 px phone in Japanese with the row's Revoke? open), so it never runs under the row's buttons. This is how chip-style labels behave in the apps we compare against (the GitHub and Linear label chips, iOS Settings' badges): a chip moves as a unit and is never cut across two lines. A first version also had `white-space: nowrap`; Codex's review showed it could overflow a narrow column (MEDIUM), so it was dropped. ## The other items in #1179, checked on main d9050a0 - **2. Shortcut overrides across tabs**: fixed by #1827. - **3. Split view after "Close this half"**: not reproduced. A probe on the isolated test herdr closed a half in six layouts (two tabs with each half active, closing left or right; one tab drawn in both halves, closing either; one single-pane tab in both halves). After each close, `.xterm` count equalled the remaining tab's panes, `document.hasFocus()` was true and no "Paused while you use another window" banner showed, also 2.5 s later (past `RELEASE_AFTER_MS`). - **4. Phone tap while reconnecting**: not reproduced. At 390 px with touch emulation, the socket was dropped and refused (`routeWebSocket`) until the pane showed "Reconnecting to Ovis…". A tap on the grid then focused `xterm-helper-textarea` in both the auto and the line input modes, and typed text showed as "Input held" in the banner. - **5. PSReadLine colours on the light theme**: these are PowerShell's own colours for a dark background; the mirrored pane draws what the program sends. No change. Closes #1179 ## How it was verified - `scripts/device-security-demo-regression.ts` (the watching-device block) now sets the current device's name, in place, to every prefix of a long name and checks the pill is one box, one line high as beside a one-letter name. It then narrows the name column to the pill's widest word plus its margin and checks the pill stays inside it. Mutation runs: the old CSS fails the first check at 390; the `nowrap` version fails the second; this change passes at 390 and 1440, light and dark, and Korean at 390. - `bun run check fast`: success on 2c99503 (7925 pass, 0 fail). - Reviews: omo-native-code-reviewer (found the rect-count check could not see a pill wrapping inside its own box; fixed with the height check) and Codex Sol 6.1 Fast xhigh (MEDIUM above, fixed; re-review PASS on 2c99503).
This was referenced Oct 31, 2026
devswha
added a commit
that referenced
this pull request
Oct 31, 2026
…stays (#2485) (#2486) <!-- See CONTRIBUTING.md for checks, translations, contract tests and the changelog (a file in changelog.d/, never CHANGELOG.md). --> ## Change Closes #2485. An open Ovis tab kept the settings it had loaded. The next time it saved any setting, it wrote all of them back to `localStorage`, which undid any change another tab of the same browser had made since. Reproduced on origin/main 653613c in headless Chromium against an isolated server: tab A set Chat width to Wide and turned on the Artifacts chip, then tab B (already open) raised the terminal font size. After a reload, Chat width was `default` and the Artifacts chip was off. `SettingsProvider.update` (`src/lib/settings.ts`) now writes only the settings this tab changed, laid over what is stored now (`loadSettings()`). A setting counts as this tab's change when it differs from the tab's current state, or from `stored`: the tab's state at its last load or successful save. So: - a value handed to `update` that the tab already holds, such as one from preferences sync, does not overwrite another tab's newer value; - a change whose save failed (a full quota, private mode) is written with the tab's next successful save; - #1827's live shortcut sync is unchanged, and `stored` follows the shortcuts it takes in. Trade-off: in a stale tab, choosing the option it already shows (for example Chat width Default, while another tab chose Wide) writes nothing, because that is not a change from this tab's point of view. The tab still shows its own value until it reloads. Device settings are not pushed live into other open tabs; that would move layout under the reader (the proposal's other option). The shared settings on the server already sync by diff (`preferencesSync.ts`) and are not touched here. #2374 (a change lost on reload within 600 ms) is a separate mechanism with its own PR. ## Validation - Failing first: `src/lib/settings.hook.test.ts` gains 3 cases; on main's `settings.ts`, the two cross-tab cases fail ("default"/"system" written over the other tab's values), and they pass with the fix. - `scripts/settings-tabs-regression.ts` (new, also in `ui-contexts-checks.ts`): a two-tab Chromium check through the real Settings dialog. Fails on main (`chatWidth: 'default', composerArtifacts: 'false'` after the reload) and passes with the fix: `bun run check run --build bun scripts/settings-tabs-regression.ts`. - `HERDR_TEST_MODE=unit bun test src/lib/settings.hook.test.ts src/lib/settings.test.ts src/lib/preferencesSync.hook.test.ts`: 127 pass. - `bun run check fast`: pass (on the final source). - Not run: `check full` and the whole `test:ui` suite (CI runs it). - Reviews: omo code review APPROVE (its MEDIUM on the browser check, which could pass without tab B saving, is fixed; it now waits for the exact stepped size). Codex Terra: 3 MEDIUM. Two are fixed: a value already held no longer overwrites the other tab's (new test), and a failed save is kept for the next one (new test). One is declined: two tabs saving in the same instant can still race, because `localStorage` has no read-merge-write transaction. That window is a few microseconds on one event loop, against the whole time a tab stays open before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
When you change a keyboard shortcut in Settings, every other tab of Ovis already open in the same browser now uses the new binding right away, without a reload. Before, an already-open tab kept the old shortcuts until it was reloaded.
Why
Shortcut overrides are per browser and device (one localStorage record), but each tab read them only on load.
SettingsProvidernow listens for the browser'sstorageevent on the settings record and takes onlyshortcutOverridesfrom it. It writes nothing back, so there is no echo between tabs, and the tab's other in-memory settings are left alone. Astorage.clear()(keynull) or a removed record returns the shortcuts to their defaults.Refs #1179
How it was verified
src/lib/settings.hook.test.ts: another tab's save updates a mounted consumer without a write and without touching other settings; a removed record orclear()restores the defaults; unrelated keys are ignored. The reviewer's mutation runs showed that removing the listener, the key filter or the null-key branch makes these tests fail.terminalFontSize) kept its value, and the pages logged no errors. The same check on origin/main fails the three live-update steps.bun run check fastpassed.Known and unchanged: a stale tab's next save of any other device setting still writes its own older copies of the non-shortcut settings. That is outside this change and can be a follow-up.