Skip to content

Web: open tabs share settings changes, so one tab no longer undoes another's (#8644) - #8832

Merged
bherbruck merged 2 commits into
tangency-labs:mainfrom
austin62jake:web-tabs-share-prefs
Oct 29, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:mainfrom
austin62jake:web-tabs-share-prefs

Conversation

@austin62jake

@austin62jake austin62jake commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #8644

Change

All open tabs of the web app share one place in the browser's storage for the settings (solidcraft.prefs). eframe saves each tab's whole copy there every 30 s and whenever the page loses focus, so the tab that saves last wins. As the reporter found in #8685, a toolbar change made in one tab was overwritten by another open tab's next save, which still held the old toolbar.

Now:

  • A tab writes its settings in the frame they change. Only frames with input are checked, since that's what changes settings, and nothing is written while they stay the same. eframe's own save still runs as before.
  • The other open tabs load them at once. The browser sends a storage event to every other tab of the page when one writes. Each tab listens for it on the settings key, and its next frame loads the settings with SolveApp::load_prefs, so its own saves keep them instead of putting its older copy back. Settings a tab loaded this way aren't written back.

So a setting changed in one tab also shows in the other open tabs right away. A tab in the background picks them up when it's next shown, before it can save anything.

Embedded pages (?embed) don't keep settings, and don't listen either.

One case this doesn't change: with Preferences open in tab B, a change made in tab A shows in B's Preferences, but Cancel in B puts back what B had when Preferences opened, A's change included.

Changes a default: no

Tests

  • solidcraft-web: changed_settings_are_written_once_and_loaded_ones_not_at_all and only_settings_another_tab_wrote_are_loaded, for the two small pieces of logic the browser code uses.
  • prefs::tests::settings_loaded_over_changed_ones_replace_them_all: the sync relies on loading replacing a running app's settings whole. A tab that had pinned a command to Shortcuts, added a keyboard shortcut, changed the toolbar and more, then loads another tab's settings, ends up saving exactly the other tab's settings.

Validation

On Windows 10 x86_64, on main at 07d692e:

  • cargo test --profile ci -p solidcraft-web: 26 passed.

  • cargo test --profile ci -p solidcraft-ui-egui --lib -- prefs: 123 passed.

  • cargo clippy --profile ci -p solidcraft-ui-egui -p solidcraft-web --all-targets -- -D warnings: pass. For --target wasm32-unknown-unknown it finds nothing in the changed code (it reports two useless_conversion errors in install.rs, which this PR doesn't touch).

  • cargo xtask assets, licences --check, lists, skills, layers and ui-containers: pass.

  • cargo xtask wasm: 12 crates build for wasm32.

  • cargo fmt --all -- --check: pass.

  • In the browser: trunk serve --release, settings cleared, two tabs of the same page, each with a new design open. Tab A removed Hole from the Model toolbar, and tab B showed it gone; tab B removed Revolve, and tab A showed that. After more than 30 s with frames in each tab (eframe's own save), the stored toolbar still had both changes. Then tab B was closed and tab A reloaded: both changes kept.

    The Model toolbar in two tabs at each step

Integration status

Branched from main at 07d692e. The only other open PR changing apps/solidcraft-web/src/main.rs is #8515 (DXF), in other parts of the file.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…other's (tangency-labs#8644)

Every open tab of the web app saved its whole copy of the settings to the
same browser storage, every 30 s and on focus loss, so a tab still holding
old settings put them back over a toolbar change made in another tab.

A tab now writes its settings in the frame they change, and the other open
tabs load them from the browser's storage event, so their own saves keep
them. Settings loaded that way aren't written back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@austin62jake
austin62jake marked this pull request as ready for review October 29, 2026 13:48
@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) ready to merge reviewed, every ask addressed; merge once CI is green owner-approved Owner reviewed a sensitive-path change (kernel, CI, build scripts, deps); only the owner adds this and removed ready to merge reviewed, every ask addressed; merge once CI is green labels Oct 29, 2026
@bherbruck
bherbruck enabled auto-merge October 29, 2026 21:27
@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Oct 29, 2026
@bherbruck
bherbruck added this pull request to the merge queue Oct 29, 2026
Merged via the queue into tangency-labs:main with commit 9b97e06 Oct 29, 2026
144 of 156 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) owner-approved Owner reviewed a sensitive-path change (kernel, CI, build scripts, deps); only the owner adds this ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SC is unable to save the toolbar custom settings in web version (it is lost when the tab is closed)

3 participants