diff --git a/packages/host/app/components/operator-mode/interact-submode.gts b/packages/host/app/components/operator-mode/interact-submode.gts index aadc414f62e..9335c912b48 100644 --- a/packages/host/app/components/operator-mode/interact-submode.gts +++ b/packages/host/app/components/operator-mode/interact-submode.gts @@ -752,21 +752,15 @@ export default class InteractSubmode extends Component { } let items: { name: string; icon: Icon; ref: ResolvedCodeRef }[] = []; - // A realm index card id and a recent card's id can be in different forms - // (e.g. the base realm's alias `https://cardstack.com/base/index` vs an - // instance's registered-prefix form `@cardstack/base/index`). Unresolve - // both sides to the same form so index cards are excluded regardless. - let { virtualNetwork } = this.network; + // Both sides are canonical: the realm list holds identifiers in canonical + // form and a card's `id` is canonical in memory, so index cards compare + // directly. const excludedCardIds = new Set( - this.realmServer.availableRealmIndexCardIds.map((id) => - virtualNetwork.unresolveURL(id), - ), + this.realmServer.availableRealmIndexCardIds, ); recentCards - .filter( - (card) => !excludedCardIds.has(virtualNetwork.unresolveURL(card.id)), - ) // filter out realm index cards + .filter((card) => !excludedCardIds.has(card.id)) // filter out realm index cards .map((card) => { let ref = identifyCard(card.constructor); let name = cardTypeDisplayName(card); diff --git a/packages/host/app/services/realm-server.ts b/packages/host/app/services/realm-server.ts index c64561c929f..e0c687ecf51 100644 --- a/packages/host/app/services/realm-server.ts +++ b/packages/host/app/services/realm-server.ts @@ -13,7 +13,7 @@ import window from 'ember-window-mock'; import { TrackedArray } from 'tracked-built-ins'; import { - baseRealm, + baseRealmRRI, ensureTrailingSlash, publishRealm as publishRealmOperation, SupportedMimeType, @@ -111,8 +111,14 @@ export default class RealmServerService extends Service { @service declare private realmServer: RealmServerService; private auth: AuthStatus = { type: 'anonymous' }; private client: ExtendedClient | undefined; + // Realm identifiers in canonical form. The base realm is the only entry with + // a registered prefix, so it is the only one whose form could disagree with + // an instance's `id`; user and catalog entries arrive from `_realm-auth` and + // `_catalog-realms` as real URLs with no prefix to fold to, and are already + // canonical. Seeding base with its alias URL instead is what obliges every + // caller comparing this list against a card id to reconcile the two forms. private availableRealms = new TrackedArray([ - { type: 'base', url: baseRealm.url }, + { type: 'base', url: baseRealmRRI }, ]); private archivedRealmsList = new TrackedArray([]); private archivedRealmsFetched = false; @@ -145,7 +151,7 @@ export default class RealmServerService extends Service { ); this.logout(); this.availableRealms = new TrackedArray([ - { type: 'base', url: baseRealm.url }, + { type: 'base', url: baseRealmRRI }, ...catalogRealms, ]); // Clear in place rather than reassigning: the `archivedRealms` @cached @@ -355,7 +361,7 @@ export default class RealmServerService extends Service { this.auth = { type: 'anonymous' }; this.availableRealms.splice(0, this.availableRealms.length, { type: 'base', - url: baseRealm.url, + url: baseRealmRRI, }); this.unreachableRealmServersList.splice( 0,