Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): share forum post loading and content layout (#907)

Genera9a9436b8038
diff --git a/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts b/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts
index f0b39e2fd..16be7a2a4 100644
--- a/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts
+++ b/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts
@@ -23,6 +23,8 @@ const {
mockForumOpener,
mockSearchParams,
mockSplitMode,
+ mockSplitContainerRef,
+ mockUseThreadSplitMode,
mockSplitParentSurface,
mockCommitLastCommunityRoute,
mockSetLastChannel,
@@ -40,7 +42,9 @@ const {
mockOpenerGate: vi.fn(() => null),
mockForumOpener: { data: null as null | { content: string }, isLoading: false, isError: false, error: null as Error | null, isFetching: false, refetch: vi.fn(() => Promise.resolve()) },
mockSearchParams: { value: "msg=m_target&keep=1" },
- mockSplitMode: { value: "full" as "split" | "full" },
+ mockSplitMode: { value: "full" as "pending" | "split" | "full" },
+ mockSplitContainerRef: vi.fn(),
+ mockUseThreadSplitMode: vi.fn(),
mockSplitParentSurface: vi.fn(() => null),
mockCommitLastCommunityRoute: vi.fn(),
mockSetLastChannel: vi.fn(),
@@ -78,6 +82,11 @@ const {
routeHydrated: true,
routeLifecycle: "ready" as "pending" | "ready" | "terminal-error",
skeletonSubtype: "unknown" as "unknown" | "text" | "forum" | "thread",
+ layoutHint: {
+ subtype: "unknown" as "unknown" | "text" | "forum" | "thread",
+ parentChannelId: null as string | null,
+ parentSubtype: "unknown" as "unknown" | "text" | "forum",
+ },
},
mockMemberViewModel: {
composerMembers: [],
@@ -199,20 +208,21 @@ vi.mock("@/hooks/community/use-native-system-notifications", () => ({
mockDismissConversation(...args),
}))
vi.mock("@/hooks/community/use-thread-split-mode", () => ({
- useThreadSplitMode: () => ({ containerRef: vi.fn(), mode: mockSplitMode.value }),
+ useThreadSplitMode: (options: unknown) => {
+ mockUseThreadSplitMode(options)
+ return { containerRef: mockSplitContainerRef, mode: mockSplitMode.value }
+ },
}))
vi.mock("@/components/community/channels/thread-split-parent-surface", () => ({
ThreadSplitParentSurface: mockSplitParentSurface,
}))
vi.mock("@/components/community/channels/thread-split-view", () => ({
ThreadSplitView: ({
- containerRef,
split,
parent,
thread,
conversationSubtype,
}: {
- containerRef: React.Ref<HTMLElement>
split: boolean
parent: React.ReactNode
thread: React.ReactNode
@@ -220,7 +230,6 @@ vi.mock("@/components/community/channels/thread-split-view", () => ({
}) => React.createElement(
"main",
{
- ref: containerRef,
"data-testid": "community-thread-split",
"data-layout": split ? "split" : "full",
"data-community-conversation-subtype": conversationSubtype,
@@ -367,6 +376,8 @@ describe("ChannelRoute message surface ownership", () => {
mockForumOpener.refetch.mockClear()
mockSearchParams.value = "msg=m_target&keep=1"
mockSplitMode.value = "full"
+ mockSplitContainerRef.mockClear()
+ mockUseThreadSplitMode.mockClear()
mockSplitParentSurface.mockClear()
mockBreakpoint.value = "desktop"
mockHeaderServerNavigate.current = undefined
@@ -400,6 +411,7 @@ describe("ChannelRoute message surface ownership", () => {
routeHydrated: true,
routeLifecycle: "ready",
skeletonSubtype: "unknown",
+ layoutHint: { subtype: "unknown", parentChannelId: null, parentSubtype: "unknown" },
})
})
@@ -515,6 +527,102 @@ describe("ChannelRoute message surface ownership", () => {
expect(mockCommitLastCommunityRoute).not.toHaveBeenCalled()
})
+ it("reserves forum and post skeletons from structure without a readable server or parent", () => {
+ Object.assign(mockRouteModel, {
+ server: null, channel: null, parent: null, currentChannelMeta: null,
+ routeLifecycle: "pending", routeHydrated: false, skeletonSubtype: "thread",
+ layoutHint: { subtype: "thread", parentChannelId: "forum_1", parentSubtype: "forum" },
+ })
+ mockSplitMode.value = "split"
+ mockNavigationGate.allowed = false
+ mockCurrentChannelId.value = null
+ render(React.createElement(ChannelRoute, { serverParam: "server_1", channelId: "channel_1" }))
+ expect(screen.getByTestId("community-thread-split")).toHaveAttribute("data-layout", "split")
+ expect(screen.getByTestId("community-thread-split-parent")).toContainElement(screen.getByTestId("forum-view-skeleton"))
+ expect(screen.getByTestId("community-thread-split-panel").querySelector("[data-message-list-skeleton]")).not.toBeNull()
+ expect(mockUseThreadSplitMode).toHaveBeenLastCalledWith({ parentChannelId: null, forceFullscreen: false })
+ expect(mockSplitParentSurface).not.toHaveBeenCalled()
+ expect(mockedUseChannelMessageFeed).not.toHaveBeenCalled()
+ expect(mockCommitLastCommunityRoute).not.toHaveBeenCalled()
+ expect(mockDismissConversation).toHaveBeenLastCalledWith("viewer_1", {
+ kind: "server", serverId: "server_1", channelId: "channel_1",
+ }, false)
+ })
+
+ it("keeps unresolved geometry and parent type neutral", () => {
+ configureThreadRoute()
+ mockSplitMode.value = "pending"
+ const props = { serverParam: "server_1", channelId: "channel_1" }
+ const renderer = render(React.createElement(ChannelRoute, props))
+ expect(screen.queryByTestId("community-thread-split")).toBeNull()
+ expect(renderer.container.querySelector('[data-community-conversation-subtype="unknown"]')).not.toBeNull()
+ expect(mockedUseChannelMessageFeed).not.toHaveBeenCalled()
+ Object.assign(mockRouteModel, {
+ parent: null, currentChannelMeta: null, routeHydrated: false, routeLifecycle: "pending",
+ skeletonSubtype: "thread",
+ layoutHint: { subtype: "thread", parentChannelId: null, parentSubtype: "unknown" },
+ })
+ mockSplitMode.value = "split"
+ renderer.rerender(React.createElement(ChannelRoute, props))
+ expect(screen.getByTestId("community-thread-split-parent").querySelector('[data-community-conversation-subtype="unknown"]')).not.toBeNull()
+ expect(mockSplitParentSurface).not.toHaveBeenCalled()
+ renderer.unmount()
+ })
+
+ it("keeps the measurement frame and split nodes while pending content becomes readable", () => {
+ Object.assign(mockRouteModel, { channel: null, routeLifecycle: "pending", routeHydrated: false })
+ const props = { serverParam: "server_1", channelId: "channel_1" }
+ const renderer = render(React.createElement(ChannelRoute, props))
+ const outer = renderer.container.firstElementChild
+ expect(outer?.tagName).toBe("DIV")
+ expect(mockSplitContainerRef).toHaveBeenCalledWith(outer)
+ Object.assign(mockRouteModel, {
+ skeletonSubtype: "thread",
+ layoutHint: { subtype: "thread", parentChannelId: "parent_1", parentSubtype: "text" },
+ })
+ mockSplitMode.value = "split"
+ renderer.rerender(React.createElement(ChannelRoute, props))
+ const split = screen.getByTestId("community-thread-split")
+ const parent = screen.getByTestId("community-thread-split-parent")
+ const thread = screen.getByTestId("community-thread-split-panel")
+ configureThreadRoute()
+ Object.assign(mockRouteModel, { routeLifecycle: "ready", routeHydrated: true })
+ mockedUseChannelMessageFeed.mockReturnValue(feed())
+ renderer.rerender(React.createElement(ChannelRoute, props))
+ expect(renderer.container.firstElementChild).toBe(outer)
+ expect(screen.getByTestId("community-thread-split")).toBe(split)
+ expect(screen.getByTestId("community-thread-split-parent")).toBe(parent)
+ expect(screen.getByTestId("community-thread-split-panel")).toBe(thread)
+ expect(mockSplitContainerRef).toHaveBeenCalledTimes(1)
+ expect(mockedUseChannelMessageFeed).toHaveBeenCalledOnce()
+ mockRouteModel.metadataError = true
+ renderer.rerender(React.createElement(ChannelRoute, props))
+ expect(renderer.container.firstElementChild).toBe(outer)
+ expect(screen.getByRole("button", { name: "Retry" })).toBeVisible()
+ renderer.unmount()
+ })
+
+ it("lets the qualified parent load while the forum opener still fences the child", () => {
+ configureThreadRoute()
+ mockRouteModel.isForumPostChild = true
+ mockSplitMode.value = "split"
+ mockForumOpener.isLoading = true
+ const props = { serverParam: "server_1", channelId: "channel_1" }
+ const renderer = render(React.createElement(ChannelRoute, props))
+ const split = screen.getByTestId("community-thread-split")
+ expect(mockSplitParentSurface).toHaveBeenCalledOnce()
+ expect(mockedUseChannelMessageFeed).not.toHaveBeenCalled()
+ expect(mockCommitLastCommunityRoute).not.toHaveBeenCalled()
+ expect(screen.getByTestId("community-thread-split-panel").querySelector("[data-message-list-skeleton]")).not.toBeNull()
+ Object.assign(mockForumOpener, { data: { content: "Post title" }, isLoading: false })
+ mockedUseChannelMessageFeed.mockReturnValue(feed())
+ renderer.rerender(React.createElement(ChannelRoute, props))
+ expect(screen.getByTestId("community-thread-split")).toBe(split)
+ expect(mockedUseChannelMessageFeed).toHaveBeenCalledOnce()
+ expect(mockCommitLastCommunityRoute).toHaveBeenCalledOnce()
+ renderer.unmount()
+ })
+
it("shows a required cold forum opener failure, keeps Retry feedback while pending, then opens body", async () => {
configureThreadRoute()
mockRouteModel.isForumPostChild = true
diff --git a/src/web/src/components/community/channels/channel-route.tsx b/src/web/src/components/community/channels/channel-route.tsx
index b37d21da6..daf1c0022 100644
--- a/src/web/src/components/community/channels/channel-route.tsx
+++ b/src/web/src/components/community/channels/channel-route.tsx
@@ -176,7 +176,7 @@ const [topLevelRouteOwnership, setTopLevelRouteOwnership] = useAtom(useCreateAto
const notifs = useNotificationSettings()
const channelNotif = notifs.channel
const { mutate: setChannelNotif } = useSetChannelNotif()
- const threadSplit = useThreadSplitMode({
+ const { containerRef: contentContainerRef, mode: threadSplitMode } = useThreadSplitMode({
parentChannelId: currentChannelMeta?.parentChannelId ?? null,
forceFullscreen: searchParams.get(THREAD_VIEW_PARAM) === "full",
})
@@ -233,12 +233,13 @@ const [topLevelRouteOwnership, setTopLevelRouteOwnership] = useAtom(useCreateAto
uiHandlers.openProfile?.(name, e, discriminator, userId)
}, [uiHandlers])
- const channelHydrated =
+ const channelReadReady =
routeModel.routeLifecycle === "ready" &&
currentChannelId === channelId &&
routeModel.routeHydrated &&
- (!isForumPostChild || (!forumPostOpener.isLoading && !openerError)) &&
navigationGate.allowed
+ const channelHydrated = channelReadReady &&
+ (!isForumPostChild || (!forumPostOpener.isLoading && !openerError))
useNativeSystemNotificationConversationDismissal(currentUser.id, {
kind: "server",
serverId,
@@ -258,45 +259,94 @@ const [topLevelRouteOwnership, setTopLevelRouteOwnership] = useAtom(useCreateAto
isForum,
structuralHint: routeModel.skeletonSubtype,
})
- if (navigationGate.failed) {
- return <ConversationResolutionErrorFrame retrying={false} onRetry={navigationGate.retry} />
- }
- if (routeModel.serverError) {
- return <ConversationResolutionErrorFrame retrying={routeModel.retryingServer}
- onRetry={() => { void routeModel.retryServer() }} />
- }
- if (routeModel.metadataError) {
- return <ConversationResolutionErrorFrame
- retrying={routeModel.retryingMetadata}
- onRetry={() => { void routeModel.retryMetadata() }}
- />
- }
- if (openerError) {
- return <ConversationResolutionErrorFrame retrying={retryingOpener}
- onRetry={() => { void retryOpener() }} />
- }
- if (subtype === "unknown") {
- return <ConversationResolutionPendingFrame />
- }
- if (!channelHydrated) {
+ const content = (() => {
+ if (navigationGate.failed) {
+ return <ConversationResolutionErrorFrame retrying={false} onRetry={navigationGate.retry} />
+ }
+ if (routeModel.serverError) {
+ return <ConversationResolutionErrorFrame retrying={routeModel.retryingServer}
+ onRetry={() => { void routeModel.retryServer() }} />
+ }
+ if (routeModel.metadataError) {
+ return <ConversationResolutionErrorFrame
+ retrying={routeModel.retryingMetadata}
+ onRetry={() => { void routeModel.retryMetadata() }}
+ />
+ }
+ if (openerError) {
+ return <ConversationResolutionErrorFrame retrying={retryingOpener}
+ onRetry={() => { void retryOpener() }} />
+ }
+ if (subtype === "unknown") {
+ return <ConversationResolutionPendingFrame />
+ }
+ // ── Child channel view (forum post / thread opened via URL) ─────────────
if (subtype === "thread") {
- const split = threadSplit.mode === "split" && !!currentServer && !!parentChannelInServer
+ if (threadSplitMode === "pending") return <ConversationResolutionPendingFrame />
+ const split = threadSplitMode === "split"
return (
<ThreadSplitView
- containerRef={threadSplit.containerRef}
split={split}
conversationSubtype="thread"
- parent={split ? (
+ parent={split ? channelReadReady && isChildChannel && currentServer && parentChannelInServer ? (
+ <ThreadSplitParentSurface
+ serverId={serverId}
+ serverParam={serverParam}
+ server={currentServer}
+ channel={parentChannelInServer}
+ viewer={currentUser}
+ onNavigateParent={navigateServerRoot}
+ channelRefCandidates={channelRefCandidates}
+ uiHandlers={uiHandlers}
+ onOpenChild={enterThread}
+ onOpenProfile={openProfile}
+ />
+ ) : routeModel.layoutHint.parentSubtype === "unknown" ? (
+ <ConversationResolutionPendingFrame />
+ ) : (
<>
- <ChannelHeaderSkeleton kind={isForumPostChild ? "forum" : "text"} />
+ <ChannelHeaderSkeleton kind={routeModel.layoutHint.parentSubtype} />
<main className="flex min-h-0 min-w-0 flex-1 flex-col">
- {isForumPostChild
+ {routeModel.layoutHint.parentSubtype === "forum"
? <ForumViewSkeleton />
: <ConversationMessageSkeleton />}
</main>
</>
) : null}
- thread={(
+ thread={channelHydrated ? (
+ <ThreadChannelSurface
+ channelId={channelId}
+ serverId={serverId}
+ serverParam={serverParam}
+ channelName={channelName}
+ viewer={currentUser}
+ canManagePins={canManageServer(myRole)}
+ anchorMessageId={currentAnchorMessageId}
+ parentChannelId={currentChannelMeta?.parentChannelId ?? null}
+ parentMessageId={currentChannelMeta?.parentMessageId ?? null}
+ parentIsForum={isForumPostChild}
+ threadOpenerHandoff={threadOpenerHandoff}
+ childCreatorId={currentChannelMeta?.creatorId}
+ canRenameThread={canManageServer(myRole)}
+ onNavigateParent={navigateParent}
+ notificationLevel={(channelNotif[channelId] as ChannelNotifLevel) ?? USE_SERVER_DEFAULT}
+ onSetNotificationLevel={setNotificationLevel}
+ composerMembers={composerMembers}
+ composerMentionCandidates={composerMentionCandidates}
+ channelRefCandidates={channelRefCandidates}
+ memberPanelProps={memberPanelProps}
+ manageMembersDialog={manageMembersDialog}
+ uiHandlers={uiHandlers}
+ onOpenChild={enterThread}
+ onOpenProfile={openProfile}
+ resolveUserName={resolveUserName}
+ embedded
+ splitActions={split ? {
+ onFullscreen: openThreadFullscreen,
+ onClose: navigateParent,
+ } : undefined}
+ />
+ ) : (
<>
<ChannelHeaderSkeleton kind="thread" compactActions={split} />
<div className="flex min-h-0 min-w-0 flex-1 flex-col">
@@ -308,136 +358,60 @@ const [topLevelRouteOwnership, setTopLevelRouteOwnership] = useAtom(useCreateAto
/>
)
}
- if (subtype === "forum") {
+
+ if (!channelHydrated) return <ConversationResolutionPendingFrame subtype={subtype} />
+
+ // ── Forum view ──────────────────────────────────────────────────────────
+ if (isForum) {
return (
- <>
- <ChannelHeaderSkeleton kind="forum" />
- <main
- data-community-conversation-subtype="forum"
- className="flex min-h-0 min-w-0 flex-1 flex-col"
- >
- <ForumViewSkeleton />
- </main>
- </>
+ <ForumChannelSurface
+ serverId={serverId}
+ channelId={channelId}
+ channelName={channelName}
+ viewer={currentUser}
+ viewerRole={myRole}
+ onNavigateParent={navigateServerRoot}
+ notificationLevel={(channelNotif[channelId] as ChannelNotifLevel) ?? USE_SERVER_DEFAULT}
+ onSetNotificationLevel={setNotificationLevel}
+ composerMembers={composerMembers}
+ composerMentionCandidates={composerMentionCandidates}
+ memberPanelProps={memberPanelProps}
+ manageMembersDialog={manageMembersDialog}
+ onOpenPost={enterThread}
+ onOpenProfile={openProfile}
+ />
)
}
- return (
- <>
- <ChannelHeaderSkeleton />
- <main
- data-community-conversation-subtype="text"
- className="flex min-h-0 min-w-0 flex-1 flex-col"
- >
- <ConversationMessageSkeleton />
- <ComposerSkeleton />
- </main>
- </>
- )
- }
-
- // ── Child channel view (forum post / thread opened via URL) ─────────────
- if (isChildChannel) {
- const split = threadSplit.mode === "split" && !!currentServer && !!parentChannelInServer
- return (
- <ThreadSplitView
- containerRef={threadSplit.containerRef}
- split={split}
- parent={split && currentServer && parentChannelInServer ? (
- <ThreadSplitParentSurface
- serverId={serverId}
- serverParam={serverParam}
- server={currentServer}
- channel={parentChannelInServer}
- viewer={currentUser}
- onNavigateParent={navigateServerRoot}
- channelRefCandidates={channelRefCandidates}
- uiHandlers={uiHandlers}
- onOpenChild={enterThread}
- onOpenProfile={openProfile}
- />
- ) : null}
- thread={(
- <ThreadChannelSurface
- channelId={channelId}
- serverId={serverId}
- serverParam={serverParam}
- channelName={channelName}
- viewer={currentUser}
- canManagePins={canManageServer(myRole)}
- anchorMessageId={currentAnchorMessageId}
- parentChannelId={currentChannelMeta?.parentChannelId ?? null}
- parentMessageId={currentChannelMeta?.parentMessageId ?? null}
- parentIsForum={isForumPostChild}
- threadOpenerHandoff={threadOpenerHandoff}
- childCreatorId={currentChannelMeta?.creatorId}
- canRenameThread={canManageServer(myRole)}
- onNavigateParent={navigateParent}
- notificationLevel={(channelNotif[channelId] as ChannelNotifLevel) ?? USE_SERVER_DEFAULT}
- onSetNotificationLevel={setNotificationLevel}
- composerMembers={composerMembers}
- composerMentionCandidates={composerMentionCandidates}
- channelRefCandidates={channelRefCandidates}
- memberPanelProps={memberPanelProps}
- manageMembersDialog={manageMembersDialog}
- uiHandlers={uiHandlers}
- onOpenChild={enterThread}
- onOpenProfile={openProfile}
- resolveUserName={resolveUserName}
- embedded
- splitActions={split ? {
- onFullscreen: openThreadFullscreen,
- onClose: navigateParent,
- } : undefined}
- />
- )}
- />
- )
- }
- // ── Forum view ──────────────────────────────────────────────────────────
- if (isForum) {
+ // ── Standard channel view ───────────────────────────────────────────────
return (
- <ForumChannelSurface
- serverId={serverId}
+ <TextChannelSurface
channelId={channelId}
+ serverId={serverId}
+ serverParam={serverParam}
channelName={channelName}
viewer={currentUser}
- viewerRole={myRole}
+ canManagePins={canManageServer(myRole)}
+ anchorMessageId={currentAnchorMessageId}
onNavigateParent={navigateServerRoot}
notificationLevel={(channelNotif[channelId] as ChannelNotifLevel) ?? USE_SERVER_DEFAULT}
onSetNotificationLevel={setNotificationLevel}
composerMembers={composerMembers}
composerMentionCandidates={composerMentionCandidates}
+ channelRefCandidates={channelRefCandidates}
memberPanelProps={memberPanelProps}
manageMembersDialog={manageMembersDialog}
- onOpenPost={enterThread}
+ uiHandlers={uiHandlers}
+ onOpenThread={enterThread}
onOpenProfile={openProfile}
+ resolveUserName={resolveUserName}
/>
)
- }
-
- // ── Standard channel view ───────────────────────────────────────────────
+ })()
return (
- <TextChannelSurface
- channelId={channelId}
- serverId={serverId}
- serverParam={serverParam}
- channelName={channelName}
- viewer={currentUser}
- canManagePins={canManageServer(myRole)}
- anchorMessageId={currentAnchorMessageId}
- onNavigateParent={navigateServerRoot}
- notificationLevel={(channelNotif[channelId] as ChannelNotifLevel) ?? USE_SERVER_DEFAULT}
- onSetNotificationLevel={setNotificationLevel}
- composerMembers={composerMembers}
- composerMentionCandidates={composerMentionCandidates}
- channelRefCandidates={channelRefCandidates}
- memberPanelProps={memberPanelProps}
- manageMembersDialog={manageMembersDialog}
- uiHandlers={uiHandlers}
- onOpenThread={enterThread}
- onOpenProfile={openProfile}
- resolveUserName={resolveUserName}
- />
+ <div ref={contentContainerRef} className="flex min-h-0 min-w-0 flex-1 flex-col">
+ {content}
+ </div>
)
+
}
diff --git a/src/web/src/components/community/channels/thread-split-view.dom.test.ts b/src/web/src/components/community/channels/thread-split-view.dom.test.ts
index 50a831795..f8d055733 100644
--- a/src/web/src/components/community/channels/thread-split-view.dom.test.ts
+++ b/src/web/src/components/community/channels/thread-split-view.dom.test.ts
@@ -9,13 +9,14 @@ import {
const mocks = vi.hoisted(() => ({
onLayoutChanged: vi.fn(),
+ useDefaultLayout: vi.fn(),
}))
vi.mock("react-resizable-panels", () => ({
- useDefaultLayout: () => ({
+ useDefaultLayout: (options: unknown) => { mocks.useDefaultLayout(options); return ({
defaultLayout: { parent: 56, thread: 44 },
onLayoutChanged: mocks.onLayoutChanged,
- }),
+ }) },
}))
vi.mock("@/components/ui/resizable", () => ({
@@ -50,7 +51,6 @@ vi.mock("@/components/ui/resizable", () => ({
describe("ThreadSplitView", () => {
it("uses the shared persistent resize contract in split mode", () => {
render(createElement(ThreadSplitView, {
- containerRef: vi.fn(),
split: true,
parent: createElement("span", null, "Parent content"),
thread: createElement("span", null, "Thread content"),
@@ -72,11 +72,15 @@ describe("ThreadSplitView", () => {
expect(screen.getByTestId("panel-thread"))
.toHaveAttribute("data-max-size", String(THREAD_SPLIT_PANEL_MAX_WIDTH))
expect(screen.getByLabelText("Resize thread panel")).toBeVisible()
+ expect(mocks.useDefaultLayout).toHaveBeenLastCalledWith({
+ id: "community-thread-split-layout",
+ onlySaveAfterUserInteractions: true,
+ storage: expect.any(Object),
+ })
})
it("keeps full mode single-pane without resize affordances", () => {
render(createElement(ThreadSplitView, {
- containerRef: vi.fn(),
split: false,
parent: createElement("span", null, "Parent content"),
thread: createElement("span", null, "Thread content"),
@@ -87,4 +91,25 @@ describe("ThreadSplitView", () => {
expect(screen.getByLabelText("Thread")).toHaveClass("flex-1")
expect(screen.getByText("Thread content")).toBeVisible()
})
+
+ it("keeps both panels and their group when skeletons become content", () => {
+ const renderer = render(createElement(ThreadSplitView, {
+ split: true,
+ parent: createElement("span", null, "Parent skeleton"),
+ thread: createElement("span", null, "Thread skeleton"),
+ }))
+ const group = screen.getByTestId("panel-group")
+ const parent = screen.getByTestId("panel-parent")
+ const thread = screen.getByTestId("panel-thread")
+ renderer.rerender(createElement(ThreadSplitView, {
+ split: true,
+ parent: createElement("span", null, "Parent content"),
+ thread: createElement("span", null, "Thread content"),
+ }))
+ expect(screen.getByTestId("panel-group")).toBe(group)
+ expect(screen.getByTestId("panel-parent")).toBe(parent)
+ expect(screen.getByTestId("panel-thread")).toBe(thread)
+ expect(screen.queryByText("Thread skeleton")).not.toBeInTheDocument()
+ expect(mocks.onLayoutChanged).not.toHaveBeenCalled()
+ })
})
diff --git a/src/web/src/components/community/channels/thread-split-view.tsx b/src/web/src/components/community/channels/thread-split-view.tsx
index 4751c7be6..a9272b6f6 100644
--- a/src/web/src/components/community/channels/thread-split-view.tsx
+++ b/src/web/src/components/community/channels/thread-split-view.tsx
@@ -3,7 +3,7 @@
* macrostructure: parallel-conversation-panel · pre-emit: P5 H5 E4 S5 R5 V4 · slop: pass
*/
-import type { ReactNode, RefCallback } from "react"
+import type { ReactNode } from "react"
import { useDefaultLayout } from "react-resizable-panels"
import {
ResizableHandle,
@@ -23,13 +23,11 @@ const threadSplitLayoutStorage = {
}
export function ThreadSplitView({
- containerRef,
split,
parent,
thread,
conversationSubtype,
}: {
- containerRef: RefCallback<HTMLElement>
split: boolean
parent: ReactNode
thread: ReactNode
@@ -43,7 +41,6 @@ export function ThreadSplitView({
return (
<main
- ref={containerRef}
data-testid={tid.threadSplit}
data-layout={split ? "split" : "full"}
data-community-conversation-subtype={conversationSubtype}
diff --git a/src/web/src/components/community/shell/community-pending-frame.dom.test.ts b/src/web/src/components/community/shell/community-pending-frame.dom.test.ts
index 3a0abe9ee..19c58d374 100644
--- a/src/web/src/components/community/shell/community-pending-frame.dom.test.ts
+++ b/src/web/src/components/community/shell/community-pending-frame.dom.test.ts
@@ -112,17 +112,27 @@ describe("CommunityPendingFrame", () => {
expect(screen.getByLabelText("Loading server")).toHaveAttribute("aria-busy", "true")
})
- it("forwards a known navigation subtype without changing route ownership", () => {
+ it.each(["text", "forum"] as const)("forwards a known navigation subtype without changing route ownership: %s", (subtype) => {
const rendered = render(createElement(CommunityPendingFrame, {
href: "/c/channels/s1/c1",
- conversationSubtype: "forum",
+ conversationSubtype: subtype,
}))
expect(screen.getByTestId("conversation-resolution"))
- .toHaveAttribute("data-subtype", "forum")
+ .toHaveAttribute("data-subtype", subtype)
expect(rendered.container.querySelector('[data-community-main-kind="server-conversation"]'))
.toBeInTheDocument()
})
+ it("keeps a structural thread checkpoint neutral until its layout can be measured", () => {
+ const rendered = render(createElement(CommunityPendingFrame, {
+ href: "/c/channels/s1/post1", conversationSubtype: "thread",
+ }))
+ expect(screen.getByTestId("conversation-resolution")).toHaveAttribute("data-subtype", "unknown")
+ expect(screen.getByTestId("community-pending-main-server-conversation")).not.toHaveAttribute("aria-label")
+ expect(rendered.container.querySelector('[data-community-main-kind="server-conversation"]')).toBeInTheDocument()
+ expect(rendered.container.querySelectorAll("header, button, a, form, textarea")).toHaveLength(0)
+ })
+
it("uses a neutral route-resolution frame for malformed paths", () => {
const rendered = renderFrame(["/c/channels/s1/c1", "extra"].join("/"))
expect(screen.getByLabelText("Resolving community route")).toBeInTheDocument()
diff --git a/src/web/src/components/community/shell/community-pending-frame.tsx b/src/web/src/components/community/shell/community-pending-frame.tsx
index 51cdf6bf7..fbda3ee51 100644
--- a/src/web/src/components/community/shell/community-pending-frame.tsx
+++ b/src/web/src/components/community/shell/community-pending-frame.tsx
@@ -46,6 +46,7 @@ export function CommunityPendingFrame({
conversationSubtype?: "text" | "forum" | "thread"
}) {
const plan = suppliedPlan ?? resolveCommunityModulePlan(href)
+ const pendingConversationSubtype = conversationSubtype === "thread" ? undefined : conversationSubtype
const reserveMeBackSlot = reserveBackSlot || (
plan.surface === "detail" && plan.sidebar.kind === "me"
)
@@ -70,7 +71,7 @@ export function CommunityPendingFrame({
content = <ServerLandingPendingFrame />
break
case "server-conversation":
- content = <ConversationResolutionPendingFrame subtype={conversationSubtype} />
+ content = <ConversationResolutionPendingFrame subtype={pendingConversationSubtype} />
break
case "route-resolution":
content = <RouteResolutionPendingFrame />
@@ -84,7 +85,7 @@ export function CommunityPendingFrame({
data-community-main-kind={plan.main.kind}
role={plan.main.kind === "server-conversation" ? "status" : undefined}
aria-label={
- plan.main.kind === "server-conversation" && conversationSubtype
+ plan.main.kind === "server-conversation" && pendingConversationSubtype
? "Resolving conversation"
: undefined
}
diff --git a/src/web/src/hooks/community/use-channel-route-model.subscription.dom.test.ts b/src/web/src/hooks/community/use-channel-route-model.subscription.dom.test.ts
index e6b5b1459..3d20e7e04 100644
--- a/src/web/src/hooks/community/use-channel-route-model.subscription.dom.test.ts
+++ b/src/web/src/hooks/community/use-channel-route-model.subscription.dom.test.ts
@@ -21,6 +21,7 @@ const mocks = vi.hoisted(() => ({
isError: false,
},
dbChannel: undefined as undefined | Record<string, unknown>,
+ dbParent: undefined as undefined | Record<string, unknown>,
communityDb: { current: {} as Record<string, unknown> | null },
purgeCommunityChannel: vi.fn(),
}))
@@ -53,7 +54,7 @@ vi.mock("@/lib/community/last-community-route", () => ({
consumeCommunityColdEntryFailure: (...args: unknown[]) => mocks.consumeColdEntryFailure(...args),
}))
vi.mock("@/lib/community-db/projections", async (importOriginal) => ({ ...await importOriginal<typeof import("@/lib/community-db/projections")>(),
- useRouteChannelProjection: () => mocks.dbChannel,
+ useRouteChannelProjection: (id: string | null) => id === mocks.dbParent?.id ? mocks.dbParent : undefined,
}))
vi.mock("@/lib/community-db/sync", async (importOriginal) => ({ ...await importOriginal<typeof import("@/lib/community-db/sync")>(),
purgeCommunityChannel: (...args: unknown[]) => mocks.purgeCommunityChannel(...args),
@@ -68,6 +69,7 @@ function Harness({ channelId = "post-1" }: { channelId?: string }) {
return React.createElement("span", {
"data-lifecycle": result.routeLifecycle,
"data-skeleton-subtype": result.skeletonSubtype,
+ "data-layout-hint": JSON.stringify(result.layoutHint),
"data-parent-channel": result.currentChannelMeta?.parentChannelId ?? "",
"data-creator-id": result.currentChannelMeta?.creatorId ?? "",
"data-activity-at": result.currentChannelMeta?.activityAt ?? "",
@@ -100,6 +102,7 @@ beforeEach(async () => {
}
mocks.metaQuery = { data: undefined, error: null, canRead: false, isArchived: false, isError: false }
mocks.dbChannel = undefined
+ mocks.dbParent = undefined
})
@@ -152,7 +155,7 @@ describe("useChannelRouteModel subscription ownership", () => {
"uses the canonical %s subtype while the route is pending",
(type) => {
mocks.server = undefined
- mocks.dbChannel = { id: "post-1", type }
+ mocks.dbChannel = { id: "post-1", serverId: "server-1", type }
const renderer = render(React.createElement(Harness))
@@ -162,6 +165,59 @@ describe("useChannelRouteModel subscription ownership", () => {
},
)
+ it("uses only structural child and parent facts before either live resource is readable", () => {
+ mocks.server = undefined
+ mocks.dbChannel = { id: "post-1", serverId: "server-1", type: "thread", parentChannelId: "forum-1" }
+ mocks.dbParent = { id: "forum-1", serverId: "server-1", type: "forum" }
+ const renderer = render(React.createElement(Harness))
+ expect(renderer.container.querySelector("span")).toHaveAttribute("data-layout-hint", JSON.stringify({
+ subtype: "thread", parentChannelId: "forum-1", parentSubtype: "forum",
+ }))
+ expect(lifecycle(renderer)).toBe("pending")
+ expect(renderer.container.querySelector("span")).toHaveAttribute("data-parent-channel", "")
+ expect(mocks.subscribe).toHaveBeenCalledOnce()
+ expect(mocks.replace).not.toHaveBeenCalled()
+ mocks.dbChannel = undefined
+ mocks.dbParent = undefined
+ renderer.rerender(React.createElement(Harness))
+ expect(renderer.container.querySelector("span")).toHaveAttribute("data-layout-hint", JSON.stringify({
+ subtype: "unknown", parentChannelId: null, parentSubtype: "unknown",
+ }))
+ expect(mocks.subscribe).toHaveBeenCalledOnce()
+ renderer.unmount()
+ })
+
+ it.each([
+ { id: "post-old", serverId: "server-1", type: "thread" },
+ { id: "post-1", serverId: "server-old", type: "thread" },
+ { id: "post-1", serverId: "server-1", type: "thread", pending: true },
+ ])("rejects a canonical hint outside the settled route identity: %j", (row) => {
+ mocks.server = undefined
+ mocks.dbChannel = { ...row, parentChannelId: "forum-1" }
+ const renderer = render(React.createElement(Harness))
+ expect(renderer.container.querySelector("span")).toHaveAttribute("data-skeleton-subtype", "unknown")
+ expect(renderer.container.querySelector("span")).toHaveAttribute("data-layout-hint", JSON.stringify({
+ subtype: "unknown", parentChannelId: null, parentSubtype: "unknown",
+ }))
+ renderer.unmount()
+ })
+
+ it.each([
+ undefined,
+ { id: "forum-1", serverId: "server-old", type: "forum" },
+ { id: "forum-1", serverId: "server-1", type: "forum", pending: true },
+ { id: "forum-1", serverId: "server-1", type: "thread" },
+ ])("keeps an unresolved parent neutral: %j", (parent) => {
+ mocks.server = undefined
+ mocks.dbChannel = { id: "post-1", serverId: "server-1", type: "thread", parentChannelId: "forum-1" }
+ mocks.dbParent = parent
+ const renderer = render(React.createElement(Harness))
+ expect(renderer.container.querySelector("span")).toHaveAttribute("data-layout-hint", JSON.stringify({
+ subtype: "thread", parentChannelId: "forum-1", parentSubtype: "unknown",
+ }))
+ renderer.unmount()
+ })
+
it("keeps a restored structural thread pending until its Channel resource is qualified", () => {
mocks.dbChannel = {
id: "post-1",
diff --git a/src/web/src/hooks/community/use-channel-route-model.ts b/src/web/src/hooks/community/use-channel-route-model.ts
index 51f3b44a3..6be2c8baa 100644
--- a/src/web/src/hooks/community/use-channel-route-model.ts
+++ b/src/web/src/hooks/community/use-channel-route-model.ts
@@ -17,6 +17,7 @@ import {
} from "@/lib/community/last-community-route"
import { communityWsSubscribe, communityWsUnsubscribe } from "./use-community-ws"
import { getCommunityDbRegistry } from "@/lib/community-db/collections"
+import { useRouteChannelProjection } from "@/lib/community-db/projections"
import { useChannelMetadata } from "./use-channel-metadata"
import type { ChildChannelMeta } from "./use-forum-sidebar-threads"
@@ -113,19 +114,39 @@ export function useChannelRouteModel(
: model.routeHydrated && metaQuery.canRead && !metadataExit
? "ready" as const
: "pending" as const
+ const structuralChannel = metaQuery.canonical?.id === channelId
+ && metaQuery.canonical.serverId === serverId && !metaQuery.canonical.pending
+ ? metaQuery.canonical : undefined
const skeletonSubtype = routeLifecycle === "ready"
? model.isChild
? "thread" as const
: model.isForum
? "forum" as const
: "text" as const
- : metaQuery.canonical?.type === "forum"
+ : structuralChannel?.type === "forum"
? "forum" as const
- : metaQuery.canonical?.type === "text"
+ : structuralChannel?.type === "text"
? "text" as const
- : metaQuery.canonical?.type === "thread"
+ : structuralChannel?.type === "thread"
? "thread" as const
: "unknown" as const
+ const structuralParentId = skeletonSubtype === "thread"
+ ? model.currentChannelMeta?.parentChannelId ?? structuralChannel?.parentChannelId ?? null
+ : null
+ const canonicalParent = useRouteChannelProjection(structuralParentId)
+ const serverParent = server?.id === serverId
+ ? server.categories.flatMap((category) => category.channels)
+ .find((candidate) => candidate.id === structuralParentId && !candidate.pending)
+ : undefined
+ const parentType = serverParent?.type ?? (canonicalParent?.id === structuralParentId
+ && canonicalParent.serverId === serverId && !canonicalParent.pending ? canonicalParent.type : undefined)
+ const parentSubtype = parentType === "forum" ? "forum" as const
+ : parentType === "text" ? "text" as const : "unknown" as const
+ const layoutHint = useMemo(() => ({
+ subtype: skeletonSubtype,
+ parentChannelId: structuralParentId,
+ parentSubtype,
+ }), [skeletonSubtype, structuralParentId, parentSubtype])
useEffect(() => {
runtime.ui.actions.setCurrentChannelId(channelId)
return () => { runtime.ui.actions.setCurrentChannelId(null) }
@@ -153,6 +174,7 @@ export function useChannelRouteModel(
routeHydrated: model.routeHydrated && metaQuery.canRead && !metadataExit,
routeLifecycle,
skeletonSubtype,
+ layoutHint,
metadataError,
serverError,
retryingServer,
diff --git a/src/web/src/hooks/community/use-thread-split-mode.dom.test.ts b/src/web/src/hooks/community/use-thread-split-mode.dom.test.ts
index 4b63d8b4b..7b844b9c5 100644
--- a/src/web/src/hooks/community/use-thread-split-mode.dom.test.ts
+++ b/src/web/src/hooks/community/use-thread-split-mode.dom.test.ts
@@ -20,10 +20,14 @@ vi.mock("@/hooks/community/use-community-ws", () => ({
communityWsReleaseSecondaryChannel: (...args: unknown[]) => mocks.releaseSecondary(...args),
}))
-function Harness({ forceFullscreen = false }: { forceFullscreen?: boolean }) {
- const split = useThreadSplitMode({ parentChannelId: "parent_1", forceFullscreen })
+function Harness({ forceFullscreen = false, parentChannelId = "parent_1", attach = true }: {
+ forceFullscreen?: boolean
+ parentChannelId?: string | null
+ attach?: boolean
+}) {
+ const split = useThreadSplitMode({ parentChannelId, forceFullscreen })
return React.createElement("div", {
- ref: split.containerRef,
+ ref: attach ? split.containerRef : undefined,
"data-testid": "thread-split-mode",
"data-mode": split.mode,
})
@@ -43,21 +47,27 @@ describe("resolveThreadSplitMode", () => {
})).toBe("full")
})
- it("keeps mobile, unresolved, and explicit fullscreen layouts single-pane", () => {
- for (const breakpoint of ["mobile", "unknown"] as const) {
- expect(resolveThreadSplitMode({ breakpoint, contentWidth: 2000, forceFullscreen: false })).toBe("full")
- }
+ it("keeps mobile and explicit fullscreen layouts single-pane", () => {
+ expect(resolveThreadSplitMode({ breakpoint: "mobile", contentWidth: 2000, forceFullscreen: false })).toBe("full")
expect(resolveThreadSplitMode({
breakpoint: "desktop",
contentWidth: 2000,
forceFullscreen: true,
})).toBe("full")
})
+
+ it("keeps unconfirmed geometry pending instead of choosing a full layout", () => {
+ expect(resolveThreadSplitMode({ breakpoint: "unknown", contentWidth: 2000, forceFullscreen: false })).toBe("pending")
+ expect(resolveThreadSplitMode({ breakpoint: "desktop", contentWidth: null, forceFullscreen: false })).toBe("pending")
+ expect(resolveThreadSplitMode({ breakpoint: "mobile", contentWidth: null, forceFullscreen: false })).toBe("full")
+ })
})
describe("useThreadSplitMode secondary live subscription", () => {
let observerCallback: ResizeObserverCallback | null
let width: number
+ const observe = vi.fn()
+ const disconnect = vi.fn()
beforeEach(() => {
mocks.breakpoint = "desktop"
@@ -65,6 +75,8 @@ describe("useThreadSplitMode secondary live subscription", () => {
mocks.releaseSecondary.mockClear()
observerCallback = null
width = THREAD_SPLIT_MIN_CONTENT_WIDTH
+ observe.mockClear()
+ disconnect.mockClear()
vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(() => ({
width,
height: 0,
@@ -78,11 +90,40 @@ describe("useThreadSplitMode secondary live subscription", () => {
}))
vi.stubGlobal("ResizeObserver", class {
constructor(callback: ResizeObserverCallback) { observerCallback = callback }
- observe() {}
- disconnect() {}
+ observe = observe
+ disconnect = disconnect
})
})
+ it("measures the stable outer node before a parent is readable without claiming its channel", () => {
+ const renderer = render(React.createElement(Harness, { parentChannelId: null }))
+ const node = screen.getByTestId("thread-split-mode")
+ expect(node).toHaveAttribute("data-mode", "split")
+ expect(observe).toHaveBeenCalledWith(node)
+ expect(mocks.claimSecondary).not.toHaveBeenCalled()
+ renderer.rerender(React.createElement(Harness))
+ expect(screen.getByTestId("thread-split-mode")).toBe(node)
+ expect(observe).toHaveBeenCalledOnce()
+ expect(mocks.claimSecondary).toHaveBeenCalledOnce()
+ renderer.unmount()
+ expect(disconnect).toHaveBeenCalledOnce()
+ })
+
+ it("does not claim a qualified parent before either measurement or breakpoint is confirmed", () => {
+ const renderer = render(React.createElement(Harness, { attach: false }))
+ expect(screen.getByTestId("thread-split-mode")).toHaveAttribute("data-mode", "pending")
+ expect(mocks.claimSecondary).not.toHaveBeenCalled()
+ mocks.breakpoint = "unknown"
+ renderer.rerender(React.createElement(Harness))
+ expect(screen.getByTestId("thread-split-mode")).toHaveAttribute("data-mode", "pending")
+ expect(mocks.claimSecondary).not.toHaveBeenCalled()
+ mocks.breakpoint = "desktop"
+ renderer.rerender(React.createElement(Harness))
+ expect(screen.getByTestId("thread-split-mode")).toHaveAttribute("data-mode", "split")
+ expect(mocks.claimSecondary).toHaveBeenCalledOnce()
+ renderer.unmount()
+ })
+
afterEach(() => {
vi.unstubAllGlobals()
vi.restoreAllMocks()
diff --git a/src/web/src/hooks/community/use-thread-split-mode.ts b/src/web/src/hooks/community/use-thread-split-mode.ts
index e450308dd..fd827c70d 100644
--- a/src/web/src/hooks/community/use-thread-split-mode.ts
+++ b/src/web/src/hooks/community/use-thread-split-mode.ts
@@ -17,10 +17,11 @@ export function resolveThreadSplitMode({
forceFullscreen,
}: {
breakpoint: Breakpoint
- contentWidth: number
+ contentWidth: number | null
forceFullscreen: boolean
-}): "split" | "full" {
- if (forceFullscreen || breakpoint !== "desktop") return "full"
+}): "pending" | "split" | "full" {
+ if (forceFullscreen || breakpoint === "mobile") return "full"
+ if (breakpoint === "unknown" || contentWidth === null) return "pending"
return contentWidth >= THREAD_SPLIT_MIN_CONTENT_WIDTH ? "split" : "full"
}
@@ -32,14 +33,17 @@ export function useThreadSplitMode({
forceFullscreen: boolean
}): {
containerRef: RefCallback<HTMLElement>
- mode: "split" | "full"
+ mode: "pending" | "split" | "full"
} {
const runtime = useCommunityRuntime()
const breakpoint = useBreakpoint()
const [subscriptionOwner] = useState(() => Symbol("thread-split-secondary"))
const [container, setContainer] = useAtom(useCreateAtom<HTMLElement | null>(null))
- const [contentWidth, setContentWidth] = useAtom(useCreateAtom(0))
- const containerRef = useCallback((node: HTMLElement | null) => setContainer(node), [setContainer])
+ const [contentWidth, setContentWidth] = useAtom(useCreateAtom<number | null>(null))
+ const containerRef = useCallback((node: HTMLElement | null) => {
+ setContentWidth(null)
+ setContainer(node)
+ }, [setContainer, setContentWidth])
useLayoutEffect(() => {
if (!container) return
diff --git a/src/web/src/test/e2e-ui/45-desktop-thread-split-view.spec.ts b/src/web/src/test/e2e-ui/45-desktop-thread-split-view.spec.ts
index c3a920707..6f54bcf50 100644
--- a/src/web/src/test/e2e-ui/45-desktop-thread-split-view.spec.ts
+++ b/src/web/src/test/e2e-ui/45-desktop-thread-split-view.spec.ts
@@ -177,6 +177,43 @@ test.describe.serial("desktop thread split view", () => {
test("opens forum posts in the same desktop split contract", async ({ asUser }, testInfo) => {
const { page } = await asUser("alice")
await page.setViewportSize({ width: 1280, height: 900 })
+ await page.goto(`/c/channels/${serverId}/${forumId}`)
+ await expect(page.getByTestId(tid.forumThreadCard(forumPostId))).toBeVisible()
+ let releaseMetadata!: () => void
+ const metadataGate = new Promise<void>((resolve) => { releaseMetadata = resolve })
+ const metadataPath = `/api/community/channels/${forumPostId}`
+ const metadataUrl = (url: URL) => url.pathname === metadataPath
+ const holdMetadata = async (route: import("@playwright/test").Route) => {
+ await metadataGate
+ await route.continue()
+ }
+ await page.route(metadataUrl, holdMetadata)
+ try {
+ const requested = page.waitForRequest((request) => new URL(request.url()).pathname === metadataPath)
+ await page.getByTestId(tid.forumThreadCard(forumPostId)).click()
+ await requested
+ const pendingShell = page.getByTestId(tid.threadSplit)
+ const pendingParent = page.getByTestId(tid.threadSplitParent)
+ const pendingPost = page.getByTestId(tid.threadSplitPanel)
+ await expect(pendingShell).toHaveAttribute("data-layout", "split")
+ await expect(pendingParent.getByTestId(tid.forumFilterBar)).toBeVisible()
+ await expect(pendingParent.getByRole("main").locator('[data-slot="skeleton"]').first()).toBeVisible()
+ await expect(pendingParent.getByTestId(tid.forumPostList)).toHaveCount(0)
+ await expect(pendingPost.locator("[data-message-list-skeleton]")).toBeVisible()
+ const group = await pendingShell.locator('[data-slot="resizable-panel-group"]').elementHandle()
+ if (!group) throw new Error("Pending split group is unavailable")
+ const pendingWidth = (await pendingPost.boundingBox())?.width
+ if (pendingWidth === undefined) throw new Error("Pending post geometry is unavailable")
+ releaseMetadata()
+ await expect(pendingParent.getByTestId(tid.forumPostList)).toBeVisible()
+ await expect(pendingPost.getByText("Forum reply", { exact: false })).toBeVisible()
+ expect(await group.evaluate((node) => node.isConnected)).toBe(true)
+ expect(Math.abs(((await pendingPost.boundingBox())?.width ?? 0) - pendingWidth)).toBeLessThanOrEqual(1)
+ await group.dispose()
+ } finally {
+ releaseMetadata()
+ await page.unrouteAll({ behavior: "wait" })
+ }
await page.goto(`/c/channels/${serverId}/${forumPostId}`)
await expect(page.getByTestId(tid.threadSplit)).toHaveAttribute("data-layout", "split", {