Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): center loading failures within their panels

Gus2dbc068357f9
diff --git a/src/web/src/components/community/channels/conversation-resolution-error-frame.dom.test.tsx b/src/web/src/components/community/channels/conversation-resolution-error-frame.dom.test.tsx
new file mode 100644
index 000000000..9830134f4
--- /dev/null
+++ b/src/web/src/components/community/channels/conversation-resolution-error-frame.dom.test.tsx
@@ -0,0 +1,17 @@
+import { expect, it, vi } from "vitest"
+import { fireEvent, render } from "@/test/react-dom-harness"
+import { ConversationResolutionErrorFrame } from "./conversation-resolution-error-frame"
+
+it("keeps retry accessible and blocks duplicate requests", () => {
+ const onRetry = vi.fn()
+ const view = render(<ConversationResolutionErrorFrame retrying={false} onRetry={onRetry} />)
+ expect(view.getByRole("alert")).toHaveTextContent("Check your connection and try again.")
+ fireEvent.click(view.getByRole("button", { name: "Retry" }))
+ expect(onRetry).toHaveBeenCalledTimes(1)
+ view.rerender(<ConversationResolutionErrorFrame retrying onRetry={onRetry} />)
+ const pending = view.getByRole("button", { name: "Retrying…" })
+ expect(pending).toBeDisabled()
+ fireEvent.click(pending)
+ expect(onRetry).toHaveBeenCalledTimes(1)
+ expect(view.getByRole("alert")).toHaveTextContent("Couldn't verify this conversation")
+})
diff --git a/src/web/src/components/community/channels/conversation-resolution-error-frame.tsx b/src/web/src/components/community/channels/conversation-resolution-error-frame.tsx
index 35bd899d5..e9ddbabdb 100644
--- a/src/web/src/components/community/channels/conversation-resolution-error-frame.tsx
+++ b/src/web/src/components/community/channels/conversation-resolution-error-frame.tsx
@@ -1,6 +1,7 @@
"use client"
import { AlertCircle } from "lucide-react"
+import { tid } from "@/lib/community/testids"
import { Button } from "@/components/ui/button"
export function ConversationResolutionErrorFrame({
@@ -15,13 +16,13 @@ export function ConversationResolutionErrorFrame({
title?: string
}) {
return (
- <Element className="flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-4 p-4 text-center">
- <div role="alert" className="flex flex-col items-center gap-2">
+ <Element data-testid={tid.conversationLoadError} data-slot="conversation-load-error" className="flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-4 p-4 text-center">
+ <div role="alert" className="flex w-full max-w-sm flex-col items-center gap-2">
<AlertCircle className="size-5 text-muted-foreground" aria-hidden />
- <p className="text-sm font-medium">{title}</p>
- <p className="text-xs text-muted-foreground">Check your connection and try again.</p>
+ <p className="text-sm leading-snug font-medium">{title}</p>
+ <p className="text-xs leading-relaxed text-muted-foreground">Check your connection and try again.</p>
</div>
- <Button variant="outline" className="h-11 px-4 sm:h-9" onClick={onRetry} disabled={retrying}>
+ <Button data-testid={tid.conversationLoadRetry} variant="outline" className="h-11 min-w-24 px-4 sm:h-9" onClick={onRetry} disabled={retrying}>
{retrying ? "Retrying…" : "Retry"}
</Button>
</Element>
diff --git a/src/web/src/components/community/channels/dm-sidebar.tsx b/src/web/src/components/community/channels/dm-sidebar.tsx
index 5c83b12c3..aa211d362 100644
--- a/src/web/src/components/community/channels/dm-sidebar.tsx
+++ b/src/web/src/components/community/channels/dm-sidebar.tsx
@@ -111,7 +111,7 @@ export const DmSidebar = memo(function DmSidebar({
</div>
<div className="my-2 h-px bg-border" />
</div>
- <div data-slot="dm-sidebar-list" className="min-h-0 flex-1 overflow-y-auto thin-scrollbar px-2 pb-4">
+ <div data-slot="dm-sidebar-list" className="flex min-h-0 flex-1 flex-col overflow-y-auto thin-scrollbar px-2 pb-4">
<div className="mb-2 truncate px-2 text-xs font-semibold text-muted-foreground">
Direct Messages
</div>
diff --git a/src/web/src/components/community/messages/message-list-view.dom.test.ts b/src/web/src/components/community/messages/message-list-view.dom.test.ts
index 1c9eaede0..cc43aaa88 100644
--- a/src/web/src/components/community/messages/message-list-view.dom.test.ts
+++ b/src/web/src/components/community/messages/message-list-view.dom.test.ts
@@ -357,6 +357,7 @@ describe("renderMessageListView", () => {
expect(renderRows).not.toHaveBeenCalled()
expect(view.getByRole("alert")).toBeVisible()
expect(view.container.querySelector("[data-message-list-content]")).not.toHaveAttribute("inert")
+ expect(view.container.querySelector("[data-message-list-content]")).not.toHaveClass("pt-8", "pl-(--community-composer-inline-start)", "pr-(--community-composer-inline-end)")
expect(view.container.querySelector("[data-message-positioning-skeleton]")).toBeNull()
expect(view.queryByText(/Beginning of the channel/)).toBeNull()
view.rerender(renderMessageListView({ ...input, retryingInitialLoad: true }, state, renderRows))
diff --git a/src/web/src/components/community/messages/message-list-view.tsx b/src/web/src/components/community/messages/message-list-view.tsx
index b5c722920..8b32c70e2 100644
--- a/src/web/src/components/community/messages/message-list-view.tsx
+++ b/src/web/src/components/community/messages/message-list-view.tsx
@@ -71,7 +71,7 @@ export function renderMessageListView(
aria-hidden={hideContent}
inert={hideContent}
style={{ visibility: hideContent ? "hidden" : undefined }}
- className={`${props.messages.length === 0 ? "flex min-h-full flex-col justify-end pt-8" : ""} pl-(--community-composer-inline-start) pr-(--community-composer-inline-end)`}
+ className={showError ? "flex min-h-full flex-col" : `${props.messages.length === 0 ? "flex min-h-full flex-col justify-end pt-8" : ""} pl-(--community-composer-inline-start) pr-(--community-composer-inline-end)`}
>
{showError ? (
<ConversationResolutionErrorFrame as="div" retrying={!!props.retryingInitialLoad}
diff --git a/src/web/src/components/community/shell/server-sidebar-slot.tsx b/src/web/src/components/community/shell/server-sidebar-slot.tsx
index 053431e92..b97023230 100644
--- a/src/web/src/components/community/shell/server-sidebar-slot.tsx
+++ b/src/web/src/components/community/shell/server-sidebar-slot.tsx
@@ -1,4 +1,6 @@
"use client"
+
+import { ConversationResolutionErrorFrame } from "../channels/conversation-resolution-error-frame"
import { getServerDirectoryWindow } from "@/lib/community/server-directory-window"
import { readCommunityServerRailServers } from "@/lib/community-db/server-rail"
import { useAtom, useCreateAtom, useSelector } from "@tanstack/react-store";
@@ -607,15 +609,12 @@ function ServerSidebar({ serverId, href, routeCommitted }: { serverId: string; h
return <>{serverReadFailed && !currentServer || forumSidebar.sidebar.status === "error" ? (
<aside className="flex min-h-0 min-w-0 flex-1 flex-col">
- <div role="alert" className="flex flex-col gap-2 p-4 text-sm text-muted-foreground">
- <span>{serverReadFailed && !currentServer ? "Couldn't load server channels." : "Couldn't load threads."}</span>
- <button
- type="button"
- disabled={!routeCommitted || serverReadPending || forumSidebar.isFetching}
- onClick={() => { if (!currentServer) void retryServerRead(); else void forumSidebar.refetch() }}
- className="h-11 self-start rounded-md px-2 text-foreground enabled:hover:bg-accent disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:h-9"
- >Retry</button>
- </div>
+ <ConversationResolutionErrorFrame
+ as="div"
+ title={serverReadFailed && !currentServer ? "Couldn't load server channels." : "Couldn't load threads."}
+ retrying={!routeCommitted || serverReadPending || forumSidebar.isFetching}
+ onRetry={() => { if (!currentServer) void retryServerRead(); else void forumSidebar.refetch() }}
+ />
</aside>
) : sidebar()}{serverSettingsDialog}{iconCropDialog}</>
}
diff --git a/src/web/src/lib/community/testids.ts b/src/web/src/lib/community/testids.ts
index 768f52f61..246153c8e 100644
--- a/src/web/src/lib/community/testids.ts
+++ b/src/web/src/lib/community/testids.ts
@@ -43,6 +43,8 @@ export const tid = {
channelSidebarPending: (serverId: string) => `community-channel-sidebar-pending-${serverId}`,
messageHeaderLeadingLoading: "community-message-header-leading-loading",
messageHeaderTitleLoading: "community-message-header-title-loading",
+ conversationLoadError: "community-conversation-load-error",
+ conversationLoadRetry: "community-conversation-load-retry",
dmSidebarPending: "community-dm-sidebar-pending",
createServerSubmit: "community-create-server-submit",
createServerName: "community-create-server-name",