Skip to content

fix: connection list mismatch after iCloud sync#517

Merged
datlechin merged 1 commit intomainfrom
fix/connection-cache-stale
Mar 31, 2026
Merged

fix: connection list mismatch after iCloud sync#517
datlechin merged 1 commit intomainfrom
fix/connection-cache-stale

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Closes #516

Problem

Welcome window shows different connections from the connection menu after iCloud sync. Duplicating a connection makes all connections appear.

Root Cause

ConnectionStorage.saveConnections() set cachedConnections = connections BEFORE writing to UserDefaults. If encoding failed or a race occurred, cache diverged from disk. All 11 consumers read stale cache.

Fix

  • Clear cache AFTER successful write (matches GroupStorage/TagStorage pattern)
  • Add invalidateCache() method
  • Call invalidateCache() before applying remote sync changes

Test plan

  • Enable iCloud Sync, add connection on device A → appears on device B
  • Delete connection on device A → disappears on device B
  • Dock menu matches welcome window connection list
  • Connection switcher (Cmd+K) matches welcome window

ConnectionStorage.saveConnections() set cache BEFORE writing to
UserDefaults. If encoding failed or a race condition occurred, cache
diverged from disk. All consumers (welcome window, dock menu, connection
switcher) read stale data.

Fix: clear cache AFTER successful write (matching GroupStorage/TagStorage
pattern) and invalidate cache before applying remote sync changes.
@datlechin datlechin merged commit e06ded6 into main Mar 31, 2026
2 checks passed
@datlechin datlechin deleted the fix/connection-cache-stale branch March 31, 2026 02:35
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.

Connection list mismatch between welcome window and connection menu

1 participant