Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(web): keep forum card layout stable during post navigation (#1076)
Gener4b5c7f8f5e10
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.tsindex 83fb0522b..40f714927 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@@ -724,9 +724,16 @@ describe("ChannelRoute message surface ownership", () => {expect(mockedUseChannelMessageFeed).toHaveBeenCalledWith(expect.objectContaining({channelId: "parent_1"}))expect(mockClaimSecondary).not.toHaveBeenCalled()expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({channelId: "parent_1", accessAllowed: false}))+ expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({channelId: "parent_1", roleDisplayAllowed: true}))renderer.rerender(node(true))expect(mockClaimSecondary).toHaveBeenLastCalledWith(expect.anything(), expect.any(Symbol), "parent_1")expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({channelId: "parent_1", accessAllowed: true}))+ mockedUseChannelMemberViewModel.mockClear()+ renderer.rerender(node(false))+ expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({channelId: "parent_1", accessAllowed: false, roleDisplayAllowed: true}))+ mockedUseChannelMemberViewModel.mockClear()+ renderer.rerender(node(true))+ expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({channelId: "parent_1", accessAllowed: true, roleDisplayAllowed: true}))})it("lets the real parent surface read independently and retires it when its own proof is lost", async () => {@@ -753,6 +760,7 @@ describe("ChannelRoute message surface ownership", () => {expect(screen.getByTestId("community-thread-split-parent").querySelector("[data-message-list-skeleton]")).not.toBeNull()expect(mockedUseChannelMessageFeed).not.toHaveBeenCalled()expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({ channelId: "parent_1", accessAllowed: false }))+ expect(mockedUseChannelMemberViewModel).toHaveBeenCalledWith(expect.objectContaining({ channelId: "parent_1", roleDisplayAllowed: false }))expect(mockUseThreadSplitMode).toHaveBeenLastCalledWith({ breakpoint: "desktop", enabled: true, forceFullscreen: false })expect(mockReleaseSecondary).toHaveBeenLastCalledWith(runtime, owner)expect(screen.queryByLabelText("Resolving conversation")).not.toBeInTheDocument()diff --git a/src/web/src/components/community/channels/forum-channel-surface.dom.test.ts b/src/web/src/components/community/channels/forum-channel-surface.dom.test.tsindex 307989c1a..6bf8ef992 100644--- a/src/web/src/components/community/channels/forum-channel-surface.dom.test.ts+++ b/src/web/src/components/community/channels/forum-channel-surface.dom.test.ts@@ -6,6 +6,7 @@ import { ChannelHeader } from "./channel-header"import { CommunityPanel } from "../shell/community-panel"import { ForumChannelSurface } from "./forum-channel-surface"import { ForumSurface } from "./forum-surface"+import { ConversationActivityContext } from "@/contexts/community/conversation-activity"const mocks = vi.hoisted(() => ({createForumThread: vi.fn(),@@ -173,6 +174,40 @@ describe("ForumChannelSurface ownership", () => {expect(forumProps.canDeletePost?.(otherPost)).toBe(true)})+ it("keeps manager action slots during inactivity while retiring writes and following a real demotion", async () => {+ mocks.updatePostTags.mockImplementation(async ({ assertActive }) => { assertActive(); return { tags: [] } })+ mocks.deleteForumThread.mockImplementation(({ assertActive }) => { assertActive() })+ const node = (active: boolean, viewerRole: "admin" | "member") => React.createElement(+ ConversationActivityContext, { value: active },+ React.createElement(ForumChannelSurface, surfaceProps({ viewerRole })),+ )+ const view = render(node(true, "admin"))+ const activeProps = mockedForumSurface.mock.calls.at(-1)![0]+ const post = { id: "other-post", authorId: "other", openerMessageId: "opener", tags: [] } as Parameters<NonNullable<typeof activeProps.canEditPostTags>>[0]+ view.rerender(node(false, "admin"))+ const inactiveProps = mockedForumSurface.mock.calls.at(-1)![0]+ expect(inactiveProps.canEditPostTags?.(post)).toBe(true)+ expect(inactiveProps.canDeletePost?.(post)).toBe(true)+ await expect(inactiveProps.onEditPostTags?.(post, [])).rejects.toMatchObject({ name: "AbortError" })+ expect(() => inactiveProps.onDeletePost?.(post)).toThrow("Retired community view")+ await expect(activeProps.onEditPostTags?.(post, [])).rejects.toMatchObject({ name: "AbortError" })+ expect(() => activeProps.onDeletePost?.(post)).toThrow("Retired community view")+ view.rerender(node(true, "admin"))+ const resumedProps = mockedForumSurface.mock.calls.at(-1)![0]+ expect(resumedProps.canEditPostTags?.(post)).toBe(true)+ await resumedProps.onEditPostTags?.(post, [])+ expect(() => resumedProps.onDeletePost?.(post)).not.toThrow()+ view.rerender(node(true, "member"))+ const demotedProps = mockedForumSurface.mock.calls.at(-1)![0]+ expect(demotedProps.canEditPostTags?.(post)).toBe(false)+ expect(demotedProps.canDeletePost?.(post)).toBe(false)+ const ownPost = { ...post, authorId: "viewer_1" }+ expect(demotedProps.canEditPostTags?.(ownPost)).toBe(true)+ expect(demotedProps.canDeletePost?.(ownPost)).toBe(true)+ mocks.updatePostTags.mockReset()+ mocks.deleteForumThread.mockReset()+ })+it("returns a rejected tag mutation to the editor so its draft stays retryable", async () => {const error = new Error("tag update failed")mocks.updatePostTags.mockRejectedValueOnce(error)diff --git a/src/web/src/components/community/channels/thread-split-parent-surface.tsx b/src/web/src/components/community/channels/thread-split-parent-surface.tsxindex 7d480937c..4a1ec705b 100644--- a/src/web/src/components/community/channels/thread-split-parent-surface.tsx+++ b/src/web/src/components/community/channels/thread-split-parent-surface.tsx@@ -74,6 +74,7 @@ export function ThreadSplitParentSurface({isNotifyUnit: false,currentUser: viewer,accessAllowed: active && metadata.canRead,+ roleDisplayAllowed: metadata.canRead,})const notifs = useNotificationSettings()const { mutate: setChannelNotif } = useSetChannelNotif()diff --git a/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.ts b/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.tsindex 8c214fe4b..f2fa14a02 100644--- a/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.ts+++ b/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.ts@@ -1,7 +1,7 @@import { conversationEntryFromChannel } from "@/test/conversation-entry-fixtures"import { conversationEntryOptions } from "@/lib/community/conversation-entry"import "fake-indexeddb/auto"-import { createElement, type PropsWithChildren } from "react"+import { createElement, useLayoutEffect, type PropsWithChildren } from "react"import { hydrateRoot } from "react-dom/client"import { renderToString } from "react-dom/server"import { dehydrate, hydrate, CancelledError, QueryClient, QueryClientProvider } from "@tanstack/react-query"@@ -24,6 +24,7 @@ import {publishCommunityLiveSnapshot,purgeCommunityChannel,publishCommunityForumSidebar,+ publishCommunityChannelMetadata,removeCanonicalCommunityChannelMembership,setCanonicalCommunityChannelMembership,} from "@/lib/community-db/sync"@@ -230,6 +231,35 @@ function ProjectedSidebar() {}describe("forum sidebar canonical projection", () => {+ it("keeps visible posts through unrelated metadata admission and a same-window post switch", async () => {+ const { queryClient, wrapper } = await setup()+ publish(queryClient, envelopeFor(["post-1", "post-2"]), true)+ apiFetchMock.mockReturnValue(new Promise(() => {}))+ const frames: string[][] = []+ const view = renderHook(({ retainId }: { retainId: string }) => {+ const sidebar = useForumSidebarThreads("server-1", retainId)+ useLayoutEffect(() => { frames.push(sidebar.threads.map(({ id }) => id).sort()) })+ return sidebar+ }, { wrapper, initialProps: { retainId: "post-1" } })+ await waitFor(() => expect(view.result.current.threads).toHaveLength(2))+ frames.length = 0+ await act(async () => {+ publishCommunityChannelMetadata(queryClient, {+ metadata: {+ ...envelopeFor(["unlisted"]).channels[0],+ parentChannelId: "forum-1",+ parentMessageId: "unlisted-opener",+ },+ proof: { token: captureCommunityLiveSnapshotToken(queryClient), signal: undefined },+ })+ })+ view.rerender({ retainId: "post-2" })+ await waitFor(() => expect(view.result.current.threads.map(({ id }) => id).sort()).toEqual(["post-1", "post-2"]))+ expect(frames.length).toBeGreaterThan(0)+ expect(frames.every(ids => ids.join(",") === "post-1,post-2")).toBe(true)+ expect(view.result.current.threads.some(({ id }) => id === "unlisted")).toBe(false)+ })+it.each(["metadata-first", "archive-first"] as const)("keeps a direct archived opener excluded after notify refresh with %s completion", async (order) => {const { queryClient, registry, wrapper } = await setup()let resolveMetadata!: (value: unknown) => void