Skip to content

Commit

Permalink
fix(domain-manager): prioritize non-seed workspaces in selection
Browse files Browse the repository at this point in the history
Updated workspace selection logic to prioritize non-seed workspaces. Returns a seed workspace only if no non-seed workspaces are available to improve filtering consistency and avoid unintended behavior.
  • Loading branch information
AMoreaux committed Dec 19, 2024
1 parent 56daedb commit 80b57cf
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class DomainManagerService {
if (!this.environmentService.get('IS_MULTIWORKSPACE_ENABLED')) {
const workspaces = await this.workspaceRepository.find({
order: {
createdAt: 'DESC',
createdAt: 'ASC',
},
relations: ['workspaceSSOIdentityProviders'],
});
Expand All @@ -164,7 +164,7 @@ export class DomainManagerService {
),
);

return nonSeedWorkspace ?? workspaces[workspaces.length - 1];
return nonSeedWorkspace ?? workspaces[0];
}

throw new Error(
Expand Down

0 comments on commit 80b57cf

Please sign in to comment.