feat: show contacts from all logged-in accounts in Pro shell

This commit is contained in:
Linus Rath
2026-05-21 22:32:17 +02:00
parent 2c825af689
commit e80412b6fd
8 changed files with 438 additions and 51 deletions
+6 -2
View File
@@ -10,7 +10,7 @@ import { expandRecurringEvents } from '@/lib/recurrence-expansion';
import { generateUUID } from '@/lib/utils';
import { apiFetch } from '@/lib/browser-navigation';
import { BIRTHDAY_CALENDAR_ID } from '@/lib/birthday-calendar';
import { useAuthStore } from './auth-store';
import { getClientByLocalAccountId } from './client-registry';
/**
* When the Pro shell aggregates calendars/events from every connected
@@ -19,10 +19,14 @@ import { useAuthStore } from './auth-store';
* client (passed in by the page) could be on a different server entirely.
* Falls back to the active client when `localAccountId` is unset or no
* matching client is registered.
*
* Lookup goes through `client-registry` (not a direct auth-store import)
* to avoid a top-level cycle: auth-store already imports this module to
* bootstrap feature stores after login.
*/
function resolveAccountClient<T extends IJMAPClient>(active: T, localAccountId?: string): T {
if (!localAccountId) return active;
const lookup = useAuthStore.getState().getClientForAccount(localAccountId) as T | undefined;
const lookup = getClientByLocalAccountId(localAccountId) as T | undefined;
return lookup ?? active;
}