Skip to content

Commit 8192edf

Browse files
committed
fix(storage): preserve org-scoped variants and collapse no-org duplicates consistently
1 parent 119eb41 commit 8192edf

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

lib/storage.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -462,28 +462,6 @@ function deduplicateAccountsByRefreshToken<T extends AccountLike>(accounts: T[])
462462
entry.fallbackIndex = i;
463463
}
464464

465-
for (const entry of refreshMap.values()) {
466-
const fallbackIndex = entry.fallbackIndex;
467-
if (typeof fallbackIndex !== "number") continue;
468-
const orgIndices = Array.from(entry.byOrg.values());
469-
if (orgIndices.length === 0) continue;
470-
471-
const [firstOrgIndex, ...otherOrgIndices] = orgIndices;
472-
if (typeof firstOrgIndex !== "number") continue;
473-
474-
let preferredOrgIndex = firstOrgIndex;
475-
for (const orgIndex of otherOrgIndices) {
476-
preferredOrgIndex = pickNewestAccountIndex(working, preferredOrgIndex, orgIndex);
477-
}
478-
479-
const preferredOrg = working[preferredOrgIndex];
480-
const fallback = working[fallbackIndex];
481-
if (preferredOrg && fallback) {
482-
working[preferredOrgIndex] = mergeAccountRecords(preferredOrg, fallback);
483-
}
484-
indicesToRemove.add(fallbackIndex);
485-
}
486-
487465
const result: T[] = [];
488466
for (let i = 0; i < working.length; i += 1) {
489467
if (indicesToRemove.has(i)) continue;
@@ -539,12 +517,6 @@ export function deduplicateAccountsByEmail<T extends { organizationId?: string;
539517
continue;
540518
}
541519

542-
const accountId = account.accountId?.trim();
543-
if (accountId) {
544-
indicesToKeep.add(i);
545-
continue;
546-
}
547-
548520
const email = account.email?.trim();
549521
if (!email) {
550522
indicesToKeep.add(i);

0 commit comments

Comments
 (0)