import { getRoom, listMessages, listRoomMembers, MESSAGE_PAGE_SIZE } from '@app/domains/chat/model' import { chatSeedKey, prefetch, roomKey } from '@app/lib' /** * Hover prefetch for one room: the expensive core of what the chat column * loads on mount — the room row, the member directory and the tail seed page. * Pins / threads / emojis are cheap and panel-dependent, so they stay * mount-time fetches. Fire-and-forget by design: a failed prefetch is silent, * the mounting hooks surface real errors themselves. */ export function prefetchRoomView(roomId: string, spaceName: string): void { if (!roomId) return void prefetch(roomKey(roomId, 'room'), () => getRoom(roomId)) void prefetch(roomKey(roomId, 'members'), () => listRoomMembers(spaceName, roomId).catch(() => [])) void prefetch(chatSeedKey(roomId, null), () => listMessages(roomId, { limit: MESSAGE_PAGE_SIZE })) }