fix(configure): don’t write auth.order by default
This commit is contained in:
@@ -44,16 +44,25 @@ export function applyAuthProfileConfig(
|
|||||||
...(params.email ? { email: params.email } : {}),
|
...(params.email ? { email: params.email } : {}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const order = { ...cfg.auth?.order };
|
|
||||||
const list = order[params.provider] ? [...order[params.provider]] : [];
|
// Only maintain `auth.order` when the user explicitly configured it.
|
||||||
if (!list.includes(params.profileId)) list.push(params.profileId);
|
// Default behavior: no explicit order -> resolveAuthProfileOrder can round-robin by lastUsed.
|
||||||
order[params.provider] = list;
|
const existingProviderOrder = cfg.auth?.order?.[params.provider];
|
||||||
|
const order =
|
||||||
|
existingProviderOrder !== undefined
|
||||||
|
? {
|
||||||
|
...cfg.auth?.order,
|
||||||
|
[params.provider]: existingProviderOrder.includes(params.profileId)
|
||||||
|
? existingProviderOrder
|
||||||
|
: [...existingProviderOrder, params.profileId],
|
||||||
|
}
|
||||||
|
: cfg.auth?.order;
|
||||||
return {
|
return {
|
||||||
...cfg,
|
...cfg,
|
||||||
auth: {
|
auth: {
|
||||||
...cfg.auth,
|
...cfg.auth,
|
||||||
profiles,
|
profiles,
|
||||||
order,
|
...(order ? { order } : {}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user