Fix inbox route target hydration

Co-authored-by: Trace (Engineer) <9d485ff0c62915e08a801162c195c7ef096f6f6143925407255cea2656c4b8a4@buzz.block.builderlab.xyz>
Signed-off-by: Trace (Engineer) <9d485ff0c62915e08a801162c195c7ef096f6f6143925407255cea2656c4b8a4@buzz.block.builderlab.xyz>
This commit is contained in:
Trace (Engineer)
2026-08-22 19:45:36 -07:00
parent 5538199627
commit b69a654c03
3 changed files with 20 additions and 2 deletions

View File

@@ -31,13 +31,16 @@ export function buildSearchHitEvent(hit: SearchHit): RelayEvent {
};
}
export function cacheSearchHitEvent(hit: SearchHit): RelayEvent {
const event = buildSearchHitEvent(hit);
export function cacheRouteTargetEvent(event: RelayEvent): RelayEvent {
searchHitEventCache.set(event.id, event);
trimCache();
return event;
}
export function cacheSearchHitEvent(hit: SearchHit): RelayEvent {
return cacheRouteTargetEvent(buildSearchHitEvent(hit));
}
export function clearSearchHitEventCache(): void {
searchHitEventCache.clear();
}

View File

@@ -68,6 +68,7 @@ import { cn } from "@/shared/lib/cn";
import { normalizePubkey } from "@/shared/lib/pubkey";
import { useElementWidth } from "@/shared/hooks/use-mobile";
import { useThreadPanelWidth } from "@/shared/hooks/useThreadPanelWidth";
import { cacheRouteTargetEvent } from "@/app/navigation/searchHitEventCache";
import { AUXILIARY_PANEL_SINGLE_COLUMN_BREAKPOINT_PX } from "@/shared/layout/AuxiliaryPanel";
import { useHistorySearchState } from "@/shared/hooks/useHistorySearchState";
import { ProfilePanelProvider } from "@/shared/context/ProfilePanelContext";
@@ -705,6 +706,15 @@ export function HomeView({
if (!channelId) {
return;
}
cacheRouteTargetEvent({
id: item.item.id,
pubkey: item.item.pubkey,
created_at: item.item.createdAt,
kind: item.item.kind,
tags: item.item.tags,
content: item.item.content,
sig: "",
});
onOpenContext(
channelId,
item.id,

View File

@@ -295,6 +295,11 @@ test("opens a mocked channel from the inbox feed", async ({ page }) => {
/#\/channels\/9a1657ac-f7aa-5db0-b632-d8bbeb6dfb50\?messageId=mock-feed-mention$/,
);
await expect(page.getByTestId("chat-title")).toHaveText("general");
const targetRow = page
.getByTestId("message-timeline")
.locator('[data-message-id="mock-feed-mention"]');
await expect(targetRow).toBeVisible();
await expect(targetRow).toHaveClass(/route-target-highlight-fade/);
});
test("Inbox excludes generic channel and unowned agent traffic", async ({