Skip to content

[Bug]: Default identity (preferredPrimaryId) persists only in browser localStorage, not synced settings — lost on a new browser / after clearing site data #507

Description

@wryfi

Description

The selected default identity does not persist across browsers or survive clearing site data, even though all other per-account settings sync correctly. The value appears to live only in the browser-local identity-storage store and is never written to the server-side encrypted settings, so there is no cross-device/server persistence.

Steps to Reproduce

  1. Create an alias for your account in Stalwart.
  2. In Bulwark, navigate to Settings > Identities
  3. Click Manage Identities
  4. Click the ⭐️ next to the non-default (alias) identity.
  5. Confirm it sticks in the current browser by composing a message (alias identity should be default in message From field).
  6. Clear site data (or open Bulwark in a different browser / private window).
  7. Compose a message. The From field defaults to to the Stalwart account default.
  8. Navigate to Settings > About & Data. Click Export to export settings as JSON.
  9. Inspect JSON file and observe lack of identity settings.

Expected Behavior

I expect my selected default sender identity to sync across browsers and survive clearing site data. I expect this selection to appear in exported JSON settings.

Actual Behavior

The default identity is not persisted server-side. It lives only in browser localStorage under identity-storage (a Zustand persist store):

  • Before setting a default identity: {"state":{"subAddress":{"recentTags":[],"tagSuggestions":{}},"preferredPrimaryId":null},"version":0}
  • After choosing a default: {"state":{"subAddress":{"recentTags":[],"tagSuggestions":{}},"preferredPrimaryId":"b"},"version":0}
  • After clearing site data: {"state":{"subAddress":{"recentTags":[],"tagSuggestions":{}},"preferredPrimaryId":null},"version":0}

There is no corresponding field in the exported settings JSON.

Bulwark Version

1.7.5

Stalwart Mail Server Version

0.16.10

Browser

Chrome / Chromium (Brave)

Operating System

macOS

Additional Context

SETTINGS_SYNC_ENABLED=true
SESSION_SECRET is set
SETTINGS_DATA_DIR is on a persistent volume

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions