Skip to content

fix(connections): safe mode level no longer resets when opening a table (#1351)#1376

Merged
datlechin merged 3 commits into
mainfrom
fix/1351-safe-mode-resets-on-table-open
May 21, 2026
Merged

fix(connections): safe mode level no longer resets when opening a table (#1351)#1376
datlechin merged 3 commits into
mainfrom
fix/1351-safe-mode-resets-on-table-open

Conversation

@datlechin
Copy link
Copy Markdown
Member

Fixes #1351.

Problem

Changing the Safe Mode level from the toolbar didn't stick: opening a table (or any reconfigure of the connection) reset it back to the connection's saved default. ConnectionToolbarState.update(from:) hard-set safeModeLevel = connection.safeModeLevel every time, and MainContentCommandActions.safeModeLevel also read the saved default, so the live choice was lost.

Fix

The live level now lives on the session, not just the saved connection:

  • ConnectionSession gains a safeModeLevel, seeded from connection.safeModeLevel on connect.
  • ConnectionToolbarState.update(from:) no longer overwrites safeModeLevel; syncFromSession resolves it from the session (falling back to the connection default), so a reconfigure keeps the live value.
  • The toolbar's Safe Mode badge writes through onSafeModeChangeMainContentCoordinator.setSafeModeLevel, which updates both the toolbar state and the session (DatabaseManager.setSafeModeLevel).
  • MainContentCommandActions.safeModeLevel reads the live toolbar state instead of the saved connection.

Tests

ConnectionSessionTests (session seeds from the connection default) and ConnectionToolbarStateTests (the live level survives an update(from:) and tracks the session).

@datlechin datlechin merged commit 5a0961f into main May 21, 2026
2 checks passed
@datlechin datlechin deleted the fix/1351-safe-mode-resets-on-table-open branch May 21, 2026 17:39
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.

Safe mode resets when opening a new table

1 participant