Skip to content

Commit c5a84a6

Browse files
committed
perf(ui): keep session hovercard data out of startup
Reuse the sidebar’s existing session projection from the lazy hovercard runtime instead of publishing a separate startup-loaded registry. This removes the registry lifecycle and its implementation-only tests while keeping the browser ownership regression and restoring the Control UI startup bundle below budget.
1 parent 42d6f3e commit c5a84a6

4 files changed

Lines changed: 4 additions & 146 deletions

File tree

‎ui/src/components/app-sidebar.ts‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
} from "../../../packages/gateway-protocol/src/index.js";
88
import type { SessionObserverDigest } from "../../../packages/gateway-protocol/src/schema/sessions.js";
99
import { isSessionRouteId, pathForRoute } from "../app-route-paths.ts";
10-
import type { ApplicationGateway } from "../app/gateway.ts";
1110
import { beginNativeWindowDragFromTopInset } from "../app/native-window-drag.ts";
1211
import { t } from "../i18n/index.ts";
1312
import { BoardAvailabilityController } from "../lib/board/availability-controller.ts";
@@ -67,10 +66,6 @@ import {
6766
} from "./lobster-pet-contract.ts";
6867
import { SessionOrganizerController } from "./session-organizer-controller.ts";
6968
import { SidebarMenusController } from "./sidebar-menus-controller.ts";
70-
import {
71-
publishSidebarSessionRows,
72-
unpublishSidebarSessionRows,
73-
} from "./sidebar-session-row-registry.ts";
7469
// The shared loader retries transient chunk failures online; a deploy-pruned
7570
// chunk still stays off until reload when that retry fails, by design.
7671
const sidebarChromeImport = createIdleImport(() =>
@@ -143,7 +138,6 @@ class AppSidebar extends AppSidebarSessionNavigationElement implements SessionLi
143138
private narrationLoad: Promise<void> | null = null;
144139
private sessionNavigationState: SidebarSessionNavigationState | undefined;
145140
private projectedSessionRows: SidebarRecentSession[] | undefined;
146-
private publishedSessionRowsGateway: ApplicationGateway | null = null;
147141
private readonly narrationSubscriptions = this.createNarrationSubscriptions();
148142
private readonly nativeGatewaysChanged = () => this.requestUpdate();
149143
private readonly refreshAppearanceSettings = () => this.context?.theme.refresh();
@@ -224,15 +218,13 @@ class AppSidebar extends AppSidebarSessionNavigationElement implements SessionLi
224218
);
225219
this.narration?.disconnect();
226220
this.catalogRendererImport.dispose();
227-
this.unpublishSessionRows();
228221
super.disconnectedCallback();
229222
}
230223

231224
protected override willUpdate(changed: PropertyValues<this>) {
232225
super.willUpdate(changed);
233226
this.sessionNavigationState = super.getSessionNavigationState();
234227
this.projectedSessionRows = super.selectedAgentSessionRows(this.sessionNavigationState);
235-
this.publishSessionRows(this.projectedSessionRows);
236228
const chip = this.activeChipAgent();
237229
// An open switcher tracks roster/reconnect updates; otherwise only hydrate
238230
// the active card and avoid background RPCs for every configured agent.
@@ -243,24 +235,6 @@ class AppSidebar extends AppSidebarSessionNavigationElement implements SessionLi
243235
this.ensureAgentIdentities(identityIds);
244236
}
245237

246-
private publishSessionRows(rows: readonly SidebarRecentSession[]): void {
247-
const gateway = this.context?.gateway ?? null;
248-
if (this.publishedSessionRowsGateway && this.publishedSessionRowsGateway !== gateway) {
249-
unpublishSidebarSessionRows(this.publishedSessionRowsGateway, this);
250-
}
251-
this.publishedSessionRowsGateway = gateway;
252-
if (gateway) {
253-
publishSidebarSessionRows(gateway, this, rows);
254-
}
255-
}
256-
257-
private unpublishSessionRows(): void {
258-
if (this.publishedSessionRowsGateway) {
259-
unpublishSidebarSessionRows(this.publishedSessionRowsGateway, this);
260-
this.publishedSessionRowsGateway = null;
261-
}
262-
}
263-
264238
ensureAgentIdentities(agentIds: readonly string[]): void {
265239
if (this.connected) {
266240
void this.context?.agentIdentity.ensure(agentIds);

‎ui/src/components/session-progress-hovercard.runtime.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
type SessionPullRequestSnapshotStore,
1212
} from "../lib/session-pull-requests.ts";
1313
import { parseAgentSessionKey } from "../lib/sessions/session-key.ts";
14+
import type { AppSidebarSessionNavigationElement } from "./app-sidebar-session-navigation.ts";
1415
import { createPortaledHovercard, PortaledHovercardController } from "./portaled-hovercard.ts";
1516
import { renderSessionHovercard } from "./session-hovercard.ts";
16-
import { getSidebarSessionRow } from "./sidebar-session-row-registry.ts";
1717

1818
const OPEN_DELAY_MS = 350;
1919
let nextHovercardId = 0;
@@ -251,7 +251,9 @@ export class SessionProgressHovercardProvider extends ReactiveElement {
251251
if (!row || !trigger || !sessionKey || !gateway || !this.open) {
252252
return;
253253
}
254-
const sidebarRow = getSidebarSessionRow(gateway, sessionKey);
254+
const sidebarRow = row
255+
.closest<AppSidebarSessionNavigationElement>("openclaw-app-sidebar")
256+
?.findSidebarSessionByKey(sessionKey);
255257
const pullRequests = this.activePullRequestKey
256258
? this.pullRequests?.get(this.activePullRequestKey)
257259
: undefined;

‎ui/src/components/sidebar-session-row-registry.test.ts‎

Lines changed: 0 additions & 62 deletions
This file was deleted.

‎ui/src/components/sidebar-session-row-registry.ts‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)