Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(async-boundary): surface fetch-failure states across read surfaces (batch 2) (#16659)

Arvin Xuceb7e7c779b0
diff --git a/.agents/skills/agent-testing/SKILL.md b/.agents/skills/agent-testing/SKILL.md
index 316961341ae..163b4e4eaeb 100644
--- a/.agents/skills/agent-testing/SKILL.md
+++ b/.agents/skills/agent-testing/SKILL.md
@@ -19,9 +19,35 @@ also run as full cloud automation. Every test session follows the same
contract:
```
-Step -1: Plan approval → Step 0: Env + Auth → Step 1: Pick surface → Step 2: Run → Step 3: Structured report → Step 4: Publish to LobeHub
+Step -2: Read the two living logs → Step -1: Plan approval → Step 0: Env + Auth → Step 1: Pick surface → Step 2: Run → Step 3: Structured report → Step 4: Publish to LobeHub
```
+## Step -2 — Read the two living logs (mandatory, before every run)
+
+Before doing anything else, read both of these in full and hold them in mind for
+this run:
+
+- [references/common-mistakes.md](./references/common-mistakes.md) — mistakes the
+ user has called out. Two that keep biting:
+ - **Never declare a case `passed` from grep/skeleton-count heuristics — open
+ the actual screenshot with Read and confirm it rendered the expected
+ content.** A blank/white page also has 0 skeletons and still matches
+ persistent nav text.
+ - **If the task's goal is verifying error/failure states, do NOT stop at
+ happy-path when injection is hard.** Escalate (see the pattern library) until
+ you have real failure-state evidence.
+- [references/probe-mock-patterns.md](./references/probe-mock-patterns.md) — the
+ verified recipes for forcing failures, beating the SWR cache/retry, and probing
+ runtime state. Read it before any run that must force an error state or inspect
+ store/SWR values, so you don't rediscover the dead ends.
+
+**Both files are living logs — append to them during the run**, in English:
+
+- User gives negative feedback → new case in `common-mistakes.md`
+ (Wrong approach / Why / What it breaks / Correct approach).
+- You hit any probe/mock that is blocked, bypassed, or needs a workaround → new
+ item in `probe-mock-patterns.md` (Situation / Doesn't work / Works).
+
## Step -1 — Plan approval for non-trivial tests
Skip directly to Step 0 if: the test is a single re-run after a fix, the plan
@@ -31,8 +57,11 @@ Otherwise, propose a test plan (surface, cases, expected evidence, assumptions)
and use the runtime structured question tool (`request_user_input` /
ask-user-question equivalent) with two fixed choices:
-1. `开始执行 (Recommended)` — 测试方案没问题,开始执行
-2. `先讨论下` — 方案有问题,先讨论下
+1. `Start (Recommended)` — the plan looks good, begin executing
+2. `Discuss first` — the plan has issues, let's talk it over first
+
+(Match the button labels to the user's conversation language at runtime, but
+keep this skill file in English.)
Wait for the user's choice before proceeding.
@@ -183,8 +212,8 @@ So before the first `agent run`, start QStash in a separate terminal and gate on
the preflight:
```bash
-./.agents/skills/agent-testing/scripts/init-dev-env.sh qstash # terminal B — keep running
-./.agents/skills/agent-testing/scripts/init-dev-env.sh preflight # exits non-zero if QStash (or Redis) is down
+./.agents/skills/agent-testing/scripts/init-dev-env.sh qstash # terminal B — keep running
+./.agents/skills/agent-testing/scripts/init-dev-env.sh preflight # exits non-zero if QStash (or Redis) is down
```
Default script env:
@@ -362,7 +391,7 @@ not a chat-only summary. Scaffold it up front and fill it as you test:
DIR=$(./.agents/skills/agent-testing/scripts/report-init.sh my-feature "Verify my feature")
# ... test, saving screenshots / CLI transcripts into $DIR/assets/ ...
# fill $DIR/result.json (scenario, context, cases[], summary.conclusion) — the report;
-# $DIR/report.md holds only the narrative tail (跟进 / 本轮验证 / 评分)
+# $DIR/report.md holds only the narrative tail (follow-ups / notes / score)
```
Reports live in `.records/reports/<timestamp>-<slug>/` (gitignored): `result.json`
@@ -380,15 +409,15 @@ Two hard rules worth front-loading:
behavior is one entry in `cases[]` (`{ name, result, observation, evidence }`);
the published `/verify/<id>` page builds the scope header from
`scenario`+`context`, the check list from `cases[]`, and the headline verdict
- from `summary.conclusion`. So do NOT hand-build a 用例 table or a 范围 block in
+ from `summary.conclusion`. So do NOT hand-build a case table or a scope block in
`report.md` — they double up on the page. `report.md` is the narrative tail
- only (跟进 / 本轮验证 / 评分).
+ only (follow-ups / this-round notes / score).
- **Visual evidence lives in `result.json`, NOT in `report.md`.** Attach each
screenshot/GIF to the relevant case via `cases[].evidence` (path or array of
paths under `$DIR`); the verify page renders it next to that check. Do NOT
embed images/GIFs in `report.md` (no `![...](assets/...)`) — they would just
double up with the per-case evidence the page already shows. `report.md` stays
- prose-only (跟进 / 备注 / 复现).
+ prose-only (follow-ups / notes / reproduction).
- **Final replies must include visual evidence links.** When a run includes UI
screenshots or GIFs, include the report directory and the most important
visual artifacts in the final chat response. Each item must include a stable
diff --git a/.agents/skills/agent-testing/references/common-mistakes.md b/.agents/skills/agent-testing/references/common-mistakes.md
new file mode 100644
index 00000000000..99d0695ffa3
--- /dev/null
+++ b/.agents/skills/agent-testing/references/common-mistakes.md
@@ -0,0 +1,70 @@
+# Common Mistakes
+
+> **Mandatory**: read this file in full before every agent-testing run and
+> self-check against each case.
+> When the user gives any negative feedback, append it here as a new case —
+> each with: Wrong approach / Why it's wrong / What it breaks / Correct approach.
+
+---
+
+## Case 1 — Judging `passed` from heuristics instead of looking at the screenshot
+
+**Wrong approach**: after navigating to a surface, deciding "renders fine /
+passed" from only `document.body.innerText` keyword greps +
+`document.querySelectorAll('[class*=Skeleton]').length === 0`, without ever
+opening the screenshot.
+
+**Why it's wrong**:
+
+- The persistent left nav / layout-shell text is always in the DOM, so an
+ innerText grep almost always false-positives.
+- A blank / white page also has 0 skeletons, so `skeletons === 0` cannot tell
+ "rendered successfully" from "rendered blank".
+
+**What it breaks**: publishes a **false `passed`**. This run's `/page`
+screenshot was actually a blank page (just the LobeHub watermark +
+`Debug ID: Desktop > Main > Layout`), yet was reported as "renders fine, proves
+removing the dead Suspense didn't break rendering" — hiding a possible real
+regression and misleading the reviewer/user.
+
+**Correct approach**: every screenshot destined for a report `evidence` **must
+first be opened with the Read tool and visually confirmed to render the expected
+content** before pass/fail. grep / counts are supporting signals only, never the
+verdict. A blank page / watermark / layout-shell-only = fail or uncertain — go
+find the root cause.
+
+---
+
+## Case 2 — Goal is verifying error states, but stopping at happy-path because injection is hard
+
+**Wrong approach**: after `network route --abort`, `window.fetch` override, and
+`set offline` all failed to force a fetch failure, giving up on the error-state
+screenshots and shipping only happy-path + unit tests, marking the core goal
+uncertain/blocked.
+
+**Why it's wrong**: the **entire point** of the task was verifying every error
+state. Abandoning that core goal = task not done. Worse, I had already written
+down viable alternatives (CDP `Network.setBlockedURLs`, server-side fault
+injection) but stopped without executing them.
+
+**What it breaks**: the deliverable doesn't cover what the user actually asked
+for — a wasted round that needs redoing.
+
+**Correct approach**: **do not stop until the core goal is met**. When the first
+batch of methods fails, immediately switch to the next known-working one. For
+this app's TRPC the working method is **client-service fetcher instrumentation
+via HMR** (throw an error with `data.httpStatus`) or server-side fault
+injection — get the **real failure-state screenshot** before writing the report.
+See `probe-mock-patterns.md` for the full working recipes.
+
+---
+
+## Case 3 — (placeholder) append the user's next negative feedback below
+
+<!-- New case template:
+## Case N — one-line summary of the mistake
+**Wrong approach**: …
+**Why it's wrong**: …
+**What it breaks**: …
+**Correct approach**: …
+-->
diff --git a/.agents/skills/agent-testing/references/probe-mock-patterns.md b/.agents/skills/agent-testing/references/probe-mock-patterns.md
new file mode 100644
index 00000000000..db908448990
--- /dev/null
+++ b/.agents/skills/agent-testing/references/probe-mock-patterns.md
@@ -0,0 +1,174 @@
+# Probe / Mock Pattern Library
+
+> **Purpose**: the accumulated, verified recipes for probing app/runtime state
+> and mocking / faulting network in agent-testing. Every time a probe or a mock
+> is **blocked, bypassed, or needs a workaround** during a run, add an item here
+> recording what does NOT work and what DOES.
+> **Read this before any run that needs to force an error state or inspect
+> runtime state.** Each item: Situation / Doesn't work / Works.
+
+---
+
+## A. Forcing a fetch to FAIL (error-state testing)
+
+### A1. `network route --abort` does not intercept this app's TRPC
+
+- **Doesn't work**: `agent-browser network route "**/trpc/**" --abort` blocks
+ nothing — 815 requests still returned 200. The interception simply doesn't
+ apply to the SPA's batched TRPC fetches.
+
+### A2. Post-load `window.fetch` override is bypassed
+
+- **Doesn't work**: `eval`-ing a `window.fetch` override after page load. The
+ TRPC client captures the `fetch` reference at client-creation (page load), so
+ it never sees a later override. (Would need `addScriptToEvaluateOnNewDocument`,
+ which agent-browser doesn't expose.)
+
+### A3. `set offline` shows Chrome's page, not the component error
+
+- **Doesn't work for component errors**: `agent-browser set offline on` trips
+ Chrome's document-level offline interstitial ("Reconnect to Wi-Fi"), not the
+ app's `AsyncError`. Its "Reload" button also false-matches error-copy greps.
+ (Offline also breaks lazy route-chunk loading → hard-nav fallback → Chrome page.)
+
+### A4. ✅ WORKS — client-service fetcher instrumentation via HMR
+
+- Add a throw at the top of the client service method the SWR fetcher calls,
+ then let Vite HMR apply it, screenshot, and `git checkout --` to revert:
+ ```ts
+ // src/services/task.ts (the method useFetchTaskList's fetcher calls)
+ list = async (params) => {
+ // [AGENT-TEST] REMOVE
+ if (true) throw Object.assign(new Error('injected'), { data: { httpStatus: 500 } });
+ return lambdaClient.task.list.query(params);
+ };
+ ```
+- `data.httpStatus: 500` → the error is retryable, so `AsyncError` shows the
+ Retry button AND the status-specific copy (`response.500`). Use a status the
+ UI treats as retryable if you want the Retry button visible.
+- Revert with `git checkout -- <service files>`; grep `AGENT-TEST` to confirm no
+ residue.
+
+### A5. ✅ ALTERNATIVES (valid, use if HMR isn't available)
+
+- CDP `Network.setBlockedURLs` — blocks at the network stack (below fetch, so it
+ DOES catch TRPC). Needs a raw CDP ws (see C2 for getting the endpoint).
+- Server-side: temporarily make the one endpoint return 500.
+
+---
+
+## B. Cache / stale state that MASKS the failure
+
+### B1. SWR persisted cache treats a failed revalidation as "keep settled content"
+
+- **Situation**: a surface loaded successfully once caches the last-good value
+ (e.g. `[]`). On a later failed fetch, `AsyncBoundary` correctly keeps the
+ settled content and does NOT show the error (by design: background error must
+ not blow away loaded content). So your injected failure shows the old content,
+ not the error.
+- **Works**: to see a genuine FIRST-LOAD error, clear all client storage, then
+ cold-load. Clearing logs you out → re-seed auth after.
+ ```js
+ // agent-browser eval --stdin
+ (async () => {
+ try {
+ localStorage.clear();
+ sessionStorage.clear();
+ } catch {}
+ try {
+ const d = await indexedDB.databases();
+ await Promise.all(
+ (d || []).map(
+ (x) =>
+ new Promise((r) => {
+ const q = indexedDB.deleteDatabase(x.name);
+ q.onsuccess = q.onerror = q.onblocked = () => r();
+ }),
+ ),
+ );
+ } catch {}
+ try {
+ const k = await caches.keys();
+ await Promise.all(k.map((c) => caches.delete(c)));
+ } catch {}
+ return 1;
+ })();
+ ```
+ then `setup-auth.sh web-seed`, then `open about:blank` → `open <target>`.
+
+### B2. SWR retries 5× (\~31s) before the error settles
+
+- **Situation**: `useClientDataSWR` retries failed fetches with exponential
+ backoff, max 5 (\~31s). During retries `isLoading` is true → you screenshot a
+ skeleton, not the error.
+- **Works**: wait \~35s after load for retries to exhaust, THEN screenshot. (Or
+ inject `meta.shouldRetry=false` to skip retries — but that also hides the Retry
+ button via `normalizeAsyncError`.)
+
+### B3. In-memory SWR cache survives `open`; persisted cache survives everything
+
+- `open about:blank` then `open <target>` forces a fresh JS context (clears
+ in-memory SWR) but does NOT clear persisted storage — you still need B1 for a
+ true cold load.
+
+---
+
+## C. Probing app / store runtime state
+
+### C1. `window.__LOBE_STORES.<name>` has no `.getState`
+
+- **Doesn't work**: `window.__LOBE_STORES.page.getState()` — the value is a bound
+ hook function exposing only `length`/`name`; state isn't readable from it.
+
+### C2. ✅ WORKS — temporary debug global inside the component
+
+- The decisive way to read a component's live props / store / SWR values: add a
+ debug global in the render, reload, read it, remove it.
+ ```tsx
+ // inside the component render, temporary:
+ if (typeof window !== 'undefined')
+ (window as any).__DBG = {
+ data: data === undefined ? 'undefined' : `array[${(data as any).length}]`,
+ hasError: !!error,
+ isLoading,
+ };
+ ```
+ ```bash
+ agent-browser --session $S eval 'JSON.stringify(window.__DBG)'
+ ```
+ This is exactly what surfaced the Pages `documents=[]` bug (data looked settled
+ even on error).
+
+### C3. Console capture is unreliable here
+
+- `agent-browser console` and `app-probe.sh errors` returned nothing this run.
+ Prefer the debug-global (C2) over console reading.
+
+---
+
+## D. agent-browser / CDP mechanics
+
+- **D1. `screenshot` needs an ABSOLUTE path.** A relative path is silently
+ ignored and it saves to `~/.agent-browser/tmp/screenshots/`. Always pass an
+ absolute path (e.g. `"$DIR/assets/x.png"` where `$DIR` is absolute).
+- **D2. CDP port is ephemeral.** `agent-browser cdp-url` returned empty and the
+ browser runs with `--remote-debugging-port=0`. For raw CDP, read
+ `DevToolsActivePort` in the browser user-data-dir.
+- **D3. offline is `agent-browser set offline on|off`** (under `set`, with
+ `viewport`/`geo`/`headers`), not a top-level `offline` command.
+- **D4. `wait --load networkidle` HANGS during a retry loop** (network never
+ idles) and can blow the command timeout — use a fixed `wait <ms>` instead when
+ a fetch is stuck retrying.
+
+---
+
+## E. Env / ports
+
+- **E1. Don't `eval "$(init-dev-env.sh env)"` just for `APP_URL`.** It can
+ clobber `PATH` in that shell (breaks `awk`/`head`/`sort`/`tr`, even
+ `agent-browser` inside a subshell loop). Hardcode the known URL
+ (`http://localhost:20874`) or export only the one var you need.
+- **E2. SPA port is configurable to coexist with another worktree.** Vite binds
+ `SPA_PORT||9876`; Next proxies `VITE_DEV_PORT||9876`. Pass `SPA_PORT=9877` to
+ `init-dev-env.sh dev` (it exports `VITE_DEV_PORT=$SPA_PORT`) so both agree and
+ you don't fight a worktree already on 9876.
diff --git a/locales/en-US/onboarding.json b/locales/en-US/onboarding.json
index 64b60cae745..d9f90de2fc7 100644
--- a/locales/en-US/onboarding.json
+++ b/locales/en-US/onboarding.json
@@ -122,6 +122,7 @@
"responseLanguage.auto": "Auto (Follow system language)",
"responseLanguage.desc": "Choose the Agent’s reply language",
"responseLanguage.hint": "After selecting a language, AI responses will use that language, and the interface language will also sync",
+ "responseLanguage.saveFailed": "Failed to save. Please try again.",
"responseLanguage.title": "Which language should we use to communicate?",
"responseLanguage.title2": "Start with language, build true understanding.",
"responseLanguage.title3": "Let me speak clearly and understand you better~",
diff --git a/locales/zh-CN/onboarding.json b/locales/zh-CN/onboarding.json
index ee04eb465ae..8b47ec8a062 100644
--- a/locales/zh-CN/onboarding.json
+++ b/locales/zh-CN/onboarding.json
@@ -122,6 +122,7 @@
"responseLanguage.auto": "自动(跟随系统语言)",
"responseLanguage.desc": "选择助理的回复语言",
"responseLanguage.hint": "切换后,助理回复语言会同步更新;界面语言也会随之切换",
+ "responseLanguage.saveFailed": "保存失败,请重试。",
"responseLanguage.title": "我们用哪种语言协作?",
"responseLanguage.title2": "从语言开始,建立理解",
"responseLanguage.title3": "说得清楚,听得明白",
diff --git a/packages/locales/src/default/onboarding.ts b/packages/locales/src/default/onboarding.ts
index 777fc306860..ebfd44c219a 100644
--- a/packages/locales/src/default/onboarding.ts
+++ b/packages/locales/src/default/onboarding.ts
@@ -132,6 +132,7 @@ export default {
'responseLanguage.desc': 'Choose the Agent’s reply language',
'responseLanguage.hint':
'After selecting a language, AI responses will use that language, and the interface language will also sync',
+ 'responseLanguage.saveFailed': 'Failed to save. Please try again.',
'responseLanguage.title': 'Which language should we use to communicate?',
'responseLanguage.title2': 'Start with language, build true understanding.',
'responseLanguage.title3': 'Let me speak clearly and understand you better~',
diff --git a/src/components/AsyncError/index.tsx b/src/components/AsyncError/index.tsx
index 5e5cf53b3c6..5b352516647 100644
--- a/src/components/AsyncError/index.tsx
+++ b/src/components/AsyncError/index.tsx
@@ -56,6 +56,7 @@ const styles = createStaticStyles(({ css }) => ({
color: ${cssVar.colorTextQuaternary};
`,
page: css`
+ flex: 1;
width: 100%;
min-height: 320px;
padding: 48px;
@@ -100,7 +101,7 @@ const AsyncError = memo<AsyncErrorProps>(
// ─── inline: single-line row failure with a retry link ───
if (variant === 'inline') {
return (
- <Flexbox horizontal align={'center'} className={styles.inline} gap={8}>
+ <Flexbox horizontal align={'center'} className={styles.inline} gap={8} justify={'center'}>
<Icon className={styles.icon} icon={TriangleAlertIcon} size={14} />
<Text color={cssVar.colorTextSecondary} fontSize={13}>
{heading}
diff --git a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx
index 53ef858c455..ddbce12a343 100644
--- a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx
+++ b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx
@@ -61,7 +61,12 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId }) => {
const { allowed: canCreateTask, reason } = usePermission('create_content');
const viewMode = useTaskStore(taskListSelectors.viewMode);
const useFetchTaskList = useTaskStore((s) => s.useFetchTaskList);
- useFetchTaskList(agentId ? { agentId } : { allAgents: true });
+ // Keep the SWR handle so a failed list fetch surfaces error + Retry instead of
+ // a permanent skeleton (the store only flips `isTaskListInit` on success — see
+ // LOBE-11181). `data` (undefined until first success) is the settled signal.
+ const { data, error, isLoading, mutate } = useFetchTaskList(
+ agentId ? { agentId } : { allAgents: true },
+ );
const isEmptyHero = useTaskStore(taskListSelectors.isListEmpty);
const rawViewOptions = useGlobalStore(systemStatusSelectors.taskListViewOptions);
const viewOptions = useMemo(() => normalizeTaskListViewOptions(rawViewOptions), [rawViewOptions]);
@@ -159,8 +164,12 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId }) => {
>
{!inlineCollapsed && <CreateTaskInlineEntry agentId={agentId} lockAssignee={!!agentId} />}
<TaskList
+ data={data}
+ error={error}
+ isLoading={isLoading}
options={viewOptions}
routeScope={routeScope}
+ onRetry={() => mutate()}
onShowHiddenCompleted={handleShowHiddenCompleted}
/>
</WideScreenContainer>
diff --git a/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx b/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx
index 89eb553af63..83b6c489880 100644
--- a/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx
+++ b/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx
@@ -15,6 +15,7 @@ import { ClipboardCheckIcon } from 'lucide-react';
import { memo, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
import { useGlobalStore } from '@/store/global';
@@ -87,10 +88,14 @@ const KanbanBoard = memo<KanbanBoardProps>(({ agentId, routeScope }) => {
const { allowed: canEditTask } = usePermission('create_content');
const useFetchTaskGroupList = useTaskStore((s) => s.useFetchTaskGroupList);
- useFetchTaskGroupList(agentId ? { agentId } : { allAgents: true });
+ // Surface a failed group fetch as error + Retry instead of a permanent
+ // skeleton board (LOBE-11181). `data` (undefined until first success) is the
+ // settled signal.
+ const { data, error, isLoading, mutate } = useFetchTaskGroupList(
+ agentId ? { agentId } : { allAgents: true },
+ );
const taskGroups = useTaskStore(taskListSelectors.taskGroups);
- const isInit = useTaskStore(taskListSelectors.isTaskGroupListInit);
const updateTaskStatus = useTaskStore((s) => s.updateTaskStatus);
const hiddenColumns = useGlobalStore(systemStatusSelectors.taskKanbanHiddenColumns);
@@ -200,34 +205,30 @@ const KanbanBoard = memo<KanbanBoardProps>(({ agentId, routeScope }) => {
[hiddenColumnSet, t, taskGroups],
);
- if (!isInit) {
- return (
- <Flexbox horizontal className={styles.board}>
- {visibleColumns.map((col) => (
- <KanbanColumn
- loading
- columnKey={col.key}
- droppable={false}
- key={col.key}
- tasks={[]}
- total={0}
- />
- ))}
- </Flexbox>
- );
- }
-
const totalTasks = taskGroups.reduce((sum, g) => sum + g.total, 0);
- if (totalTasks === 0) {
- return (
- <Center height={'80vh'} width={'100%'}>
- <Empty description={t('taskList.empty')} icon={ClipboardCheckIcon} />
- </Center>
- );
- }
+ const skeletonBoard = (
+ <Flexbox horizontal className={styles.board}>
+ {visibleColumns.map((col) => (
+ <KanbanColumn
+ loading
+ columnKey={col.key}
+ droppable={false}
+ key={col.key}
+ tasks={[]}
+ total={0}
+ />
+ ))}
+ </Flexbox>
+ );
- return (
+ const emptyState = (
+ <Center height={'80vh'} width={'100%'}>
+ <Empty description={t('taskList.empty')} icon={ClipboardCheckIcon} />
+ </Center>
+ );
+
+ const board = (
<DndContext
collisionDetection={pointerWithin}
sensors={canEditTask ? sensors : []}
@@ -276,6 +277,24 @@ const KanbanBoard = memo<KanbanBoardProps>(({ agentId, routeScope }) => {
</DragOverlay>
</DndContext>
);
+
+ // Error gated ahead of empty by AsyncBoundary so a failed fetch shows Retry
+ // instead of the "no tasks" empty (LOBE-11181). `data` is the SWR result —
+ // undefined until the first fetch settles.
+ return (
+ <AsyncBoundary
+ data={data}
+ empty={emptyState}
+ error={error}
+ errorVariant={'block'}
+ isEmpty={totalTasks === 0}
+ isLoading={isLoading}
+ loading={skeletonBoard}
+ onRetry={() => mutate()}
+ >
+ {board}
+ </AsyncBoundary>
+ );
});
export default KanbanBoard;
diff --git a/src/features/AgentTasks/AgentTaskList/TaskList.tsx b/src/features/AgentTasks/AgentTaskList/TaskList.tsx
index 50f65dea3a7..a43f66f6b2e 100644
--- a/src/features/AgentTasks/AgentTaskList/TaskList.tsx
+++ b/src/features/AgentTasks/AgentTaskList/TaskList.tsx
@@ -5,6 +5,7 @@ import { ClipboardCheckIcon, UserRound } from 'lucide-react';
import { Fragment, memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import { useTaskStore } from '@/store/task';
import { taskListSelectors } from '@/store/task/selectors';
@@ -28,6 +29,13 @@ import {
import TaskItemSkeleton from './TaskItemSkeleton';
interface TaskListProps {
+ /** The list SWR result — `undefined` until the first fetch settles (the settled signal). */
+ data?: unknown;
+ /** Thrown error from the list SWR — surfaced as a failure state, not a skeleton. */
+ error?: unknown;
+ /** First-load / retry in flight (SWR `isLoading`). */
+ isLoading?: boolean;
+ onRetry?: () => void;
onShowHiddenCompleted?: () => void;
options: TaskListViewOptions;
routeScope?: TaskItemRouteScope;
@@ -125,10 +133,10 @@ const renderGroupTitle = (group: TaskGroupMeta, count: number, sub?: boolean) =>
</Flexbox>
);
-const TaskList = memo<TaskListProps>(({ onShowHiddenCompleted, options, routeScope }) => {
+const TaskList = memo<TaskListProps>((props) => {
+ const { data, error, isLoading, onRetry, onShowHiddenCompleted, options, routeScope } = props;
const { t } = useTranslation('chat');
const tasks = useTaskStore(taskListSelectors.taskList);
- const isInit = useTaskStore(taskListSelectors.isTaskListInit);
const groupBy = normalizeGroupBy(options.groupBy, 'status');
const subGroupBy = normalizeGroupBy(options.subGroupBy, 'none');
const effectiveSubGroupBy = groupBy === 'none' ? 'none' : subGroupBy;
@@ -200,26 +208,22 @@ const TaskList = memo<TaskListProps>(({ onShowHiddenCompleted, options, routeSco
});
}, [effectiveSubGroupBy, groupBy, options, visibleTasks]);
- if (!isInit) {
- return (
- <Block gap={2} padding={2} variant={'borderless'}>
- {Array.from({ length: 5 }).map((_, index) => (
- <Fragment key={`task-skeleton-${index}`}>
- <TaskItemSkeleton />
- {index !== 4 && <Divider dashed style={{ margin: 0 }} />}
- </Fragment>
- ))}
- </Block>
- );
- }
+ const skeleton = (
+ <Block gap={2} padding={2} variant={'borderless'}>
+ {Array.from({ length: 5 }).map((_, index) => (
+ <Fragment key={`task-skeleton-${index}`}>
+ <TaskItemSkeleton />
+ {index !== 4 && <Divider dashed style={{ margin: 0 }} />}
+ </Fragment>
+ ))}
+ </Block>
+ );
- if (tasks.length === 0) {
- return (
- <Center height={'80vh'} width={'100%'}>
- <Empty description={t('taskList.empty')} icon={ClipboardCheckIcon} />
- </Center>
- );
- }
+ const emptyState = (
+ <Center height={'80vh'} width={'100%'}>
+ <Empty description={t('taskList.empty')} icon={ClipboardCheckIcon} />
+ </Center>
+ );
const hiddenFooter = hiddenCount > 0 && (
<Flexbox
@@ -242,58 +246,73 @@ const TaskList = memo<TaskListProps>(({ onShowHiddenCompleted, options, routeSco
</Flexbox>
);
- if (groupBy === 'none') {
- return (
+ const content =
+ groupBy === 'none' ? (
<>
{renderTaskListBlock(groupedTaskEntries[0]?.items ?? [], false, routeScope)}
{hiddenFooter}
</>
+ ) : (
+ <>
+ <Accordion gap={16}>
+ {groupedTaskEntries.map((group) => {
+ return (
+ <AccordionItem
+ defaultExpand
+ indicatorPlacement={'end'}
+ itemKey={`group-${group.meta.key}`}
+ key={group.meta.key}
+ paddingBlock={8}
+ paddingInline={14}
+ title={renderGroupTitle(group.meta, group.items.length)}
+ variant={'filled'}
+ styles={{
+ header: { marginBottom: 8 },
+ }}
+ >
+ {group.subGroups.length > 0 ? (
+ <Accordion gap={6}>
+ {group.subGroups.map(([subGroup, subGroupTasks]) => (
+ <AccordionItem
+ defaultExpand
+ indicatorPlacement={'end'}
+ itemKey={`sub-${group.meta.key}-${subGroup.key}`}
+ key={`${group.meta.key}-${subGroup.key}`}
+ paddingBlock={6}
+ paddingInline={14}
+ title={renderGroupTitle(subGroup, subGroupTasks.length, true)}
+ >
+ {renderTaskListBlock(subGroupTasks, true, routeScope)}
+ </AccordionItem>
+ ))}
+ </Accordion>
+ ) : (
+ renderTaskListBlock(group.items, false, routeScope)
+ )}
+ </AccordionItem>
+ );
+ })}
+ </Accordion>
+ {hiddenFooter}
+ </>
);
- }
+ // Error is gated ahead of empty by AsyncBoundary, so a failed fetch shows a
+ // Retry block instead of the "no tasks" empty (LOBE-11181). `data` is the SWR
+ // result — undefined until the first fetch settles.
return (
- <>
- <Accordion gap={16}>
- {groupedTaskEntries.map((group) => {
- return (
- <AccordionItem
- defaultExpand
- indicatorPlacement={'end'}
- itemKey={`group-${group.meta.key}`}
- key={group.meta.key}
- paddingBlock={8}
- paddingInline={14}
- title={renderGroupTitle(group.meta, group.items.length)}
- variant={'filled'}
- styles={{
- header: { marginBottom: 8 },
- }}
- >
- {group.subGroups.length > 0 ? (
- <Accordion gap={6}>
- {group.subGroups.map(([subGroup, subGroupTasks]) => (
- <AccordionItem
- defaultExpand
- indicatorPlacement={'end'}
- itemKey={`sub-${group.meta.key}-${subGroup.key}`}
- key={`${group.meta.key}-${subGroup.key}`}
- paddingBlock={6}
- paddingInline={14}
- title={renderGroupTitle(subGroup, subGroupTasks.length, true)}
- >
- {renderTaskListBlock(subGroupTasks, true, routeScope)}
- </AccordionItem>
- ))}
- </Accordion>
- ) : (
- renderTaskListBlock(group.items, false, routeScope)
- )}
- </AccordionItem>
- );
- })}
- </Accordion>
- {hiddenFooter}
- </>
+ <AsyncBoundary
+ data={data}
+ empty={emptyState}
+ error={error}
+ errorVariant={'block'}
+ isEmpty={tasks.length === 0}
+ isLoading={isLoading}
+ loading={skeleton}
+ onRetry={onRetry}
+ >
+ {content}
+ </AsyncBoundary>
);
});
diff --git a/src/features/Fleet/RunningTaskSidebar.tsx b/src/features/Fleet/RunningTaskSidebar.tsx
index 0c7d4bea5d5..1b9e8a40d7a 100644
--- a/src/features/Fleet/RunningTaskSidebar.tsx
+++ b/src/features/Fleet/RunningTaskSidebar.tsx
@@ -7,6 +7,7 @@ import { ListXIcon, PlusIcon } from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncError from '@/components/AsyncError';
import RingLoadingIcon from '@/components/RingLoading';
import { createTaskModal } from '@/features/AgentTasks/CreateTaskModal';
import { useAgentDisplayMeta } from '@/features/AgentTasks/shared/useAgentDisplayMeta';
@@ -215,7 +216,10 @@ CloseIdleColumnsButton.displayName = 'FleetCloseIdleColumnsButton';
interface RunningTaskSidebarProps {
columns: FleetColumn[];
+ /** First-load fetch failure — shown as a failed+Reload state, not fake "no tasks". */
+ error?: unknown;
isLoading?: boolean;
+ onReload?: () => void;
statusByColumnKey: Record<string, ChatTopicStatus | undefined>;
}
@@ -227,7 +231,7 @@ interface RunningTaskSidebarProps {
* list. Clicking an item opens (or re-opens) its column.
*/
const RunningTaskSidebar = memo<RunningTaskSidebarProps>(
- ({ columns, isLoading, statusByColumnKey }) => {
+ ({ columns, error, isLoading, onReload, statusByColumnKey }) => {
const { t } = useTranslation('electron');
const addColumn = useFleetStore((s) => s.addColumn);
@@ -264,7 +268,7 @@ const RunningTaskSidebar = memo<RunningTaskSidebarProps>(
right={
<Flexbox horizontal align={'center'} gap={4}>
<CloseIdleColumnsButton
- isStatusLoading={isLoading}
+ isStatusLoading={isLoading || !!error}
statusByColumnKey={statusByColumnKey}
/>
<RowsSwitcher />
@@ -278,7 +282,11 @@ const RunningTaskSidebar = memo<RunningTaskSidebarProps>(
<Button block icon={PlusIcon} onClick={handleCreateTask}>
{t('fleet.createTask')}
</Button>
- {isLoading && columns.length === 0 ? (
+ {error && columns.length === 0 ? (
+ // A failed poll must read as a failure with Reload, never as the fake
+ // "no running tasks" empty (LOBE-11167).
+ <AsyncError error={error} variant={'inline'} onRetry={onReload} />
+ ) : isLoading && columns.length === 0 ? (
Array.from({ length: 3 }).map((_, index) => <SidebarTaskSkeleton key={index} />)
) : columns.length === 0 ? (
<div className={styles.empty}>{t('fleet.noRunningTasks')}</div>
diff --git a/src/features/Fleet/index.tsx b/src/features/Fleet/index.tsx
index b774fb7e118..5b862d0a08a 100644
--- a/src/features/Fleet/index.tsx
+++ b/src/features/Fleet/index.tsx
@@ -22,7 +22,7 @@ const FleetView = memo(() => {
// (avatar/title) — otherwise a fresh entry shows the default-assistant fallback.
useFetchAgentList();
- const { columns, isInit, statusByColumnKey } = useRunningTopics();
+ const { columns, error, isInit, reload, statusByColumnKey } = useRunningTopics();
const syncRunningColumns = useFleetStore((s) => s.syncRunningColumns);
// Reconcile the live running set into the board whenever it changes (initial
@@ -39,8 +39,10 @@ const FleetView = memo(() => {
<FleetPanelCollapseSync />
<RunningTaskSidebar
columns={columns}
+ error={error}
isLoading={!isInit}
statusByColumnKey={statusByColumnKey}
+ onReload={() => reload()}
/>
<ColumnsBoard statusByColumnKey={statusByColumnKey} />
</Flexbox>
diff --git a/src/features/Fleet/useRunningTopics.ts b/src/features/Fleet/useRunningTopics.ts
index fb5a052214a..627e2af9773 100644
--- a/src/features/Fleet/useRunningTopics.ts
+++ b/src/features/Fleet/useRunningTopics.ts
@@ -33,7 +33,7 @@ const toColumn = (topic: RunningTopic): FleetColumn | null => {
* (sidebar / column badge).
*/
export const useRunningTopics = () => {
- const { data, isLoading } = useClientDataSWR(
+ const { data, error, isLoading, mutate } = useClientDataSWR(
fleetKeys.runningTopics(),
() => topicService.queryTopics({ statuses: RUNNING_STATUSES }),
// The board is a live overview — refetch on focus almost immediately
@@ -42,6 +42,11 @@ export const useRunningTopics = () => {
{ focusThrottleInterval: 1000 },
);
+ // Only a first-load failure (no data yet) is a hard error worth a failed
+ // state; a background poll error while we still hold columns keeps the stale
+ // list instead of flapping to "no running tasks" (LOBE-11167).
+ const hasHardError = Boolean(error) && data === undefined;
+
const running = useMemo(() => (data ?? []) as RunningTopic[], [data]);
const columns = useMemo(
@@ -58,5 +63,14 @@ export const useRunningTopics = () => {
return map;
}, [running]);
- return { columns, isInit: !isLoading, statusByColumnKey };
+ // `isInit` is gated on `!hasHardError` so a failed first fetch is NOT treated
+ // as "loaded, nothing running" (which would collapse every status to idle and
+ // let close-idle wipe live columns).
+ return {
+ columns,
+ error: hasHardError ? error : undefined,
+ isInit: !isLoading && !hasHardError,
+ reload: mutate,
+ statusByColumnKey,
+ };
};
diff --git a/src/features/Pages/PageLayout/Body/index.tsx b/src/features/Pages/PageLayout/Body/index.tsx
index 31006536a79..805976bc2a9 100644
--- a/src/features/Pages/PageLayout/Body/index.tsx
+++ b/src/features/Pages/PageLayout/Body/index.tsx
@@ -11,10 +11,11 @@ import {
Text,
} from '@lobehub/ui';
import { PlusIcon } from 'lucide-react';
-import React, { memo, Suspense } from 'react';
+import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
+import AsyncBoundary from '@/components/AsyncBoundary';
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import PageEmpty from '@/features/PageEmpty';
@@ -48,9 +49,12 @@ const Body = memo(() => {
// header can show a subtle in-flight indicator (mirrors the Private Agent
// pattern in `home/_layout/Body/Private`).
const useFetchDocuments = usePageStore((s) => s.useFetchDocuments);
- const { isValidating } = useFetchDocuments();
-
- const isLoading = usePageStore(pageSelectors.isDocumentsLoading);
+ // Use the SWR result as the settled signal: `data` is `undefined` until the
+ // first fetch succeeds, so a failed load surfaces error + Retry instead of a
+ // permanent skeleton. The store's `documents` field can't be the signal — it
+ // initializes to `[]` (a settled-looking empty), so a failed fetch would fall
+ // through to the "no pages" empty rather than the error (LOBE-11127).
+ const { data, error, isLoading, isValidating, mutate } = useFetchDocuments();
const filteredDocumentsCount = usePageStore(pageSelectors.filteredDocumentsCount);
const privateCount = usePageStore(pageSelectors.privateFilteredDocumentsCount);
@@ -121,30 +125,33 @@ const Body = memo(() => {
</Flexbox>
}
>
- <Suspense fallback={<SkeletonList />}>
- {isLoading ? (
- <SkeletonList />
- ) : (
- <Flexbox gap={1} paddingBlock={1}>
- {privateCount === 0 ? (
- searchActive ? (
- <Text
- align="center"
- fontSize={12}
- style={{ paddingBlock: 12, paddingInline: 8 }}
- type={'secondary'}
- >
- {t('pageList.noResults')}
- </Text>
- ) : (
- renderEmptyCreate('private')
- )
+ <AsyncBoundary
+ data={data}
+ error={error}
+ errorVariant={'inline'}
+ isLoading={isLoading}
+ loading={<SkeletonList />}
+ onRetry={() => mutate()}
+ >
+ <Flexbox gap={1} paddingBlock={1}>
+ {privateCount === 0 ? (
+ searchActive ? (
+ <Text
+ align="center"
+ fontSize={12}
+ style={{ paddingBlock: 12, paddingInline: 8 }}
+ type={'secondary'}
+ >
+ {t('pageList.noResults')}
+ </Text>
) : (
- <List visibility="private" />
- )}
- </Flexbox>
- )}
- </Suspense>
+ renderEmptyCreate('private')
+ )
+ ) : (
+ <List visibility="private" />
+ )}
+ </Flexbox>
+ </AsyncBoundary>
</AccordionItem>
<AccordionItem
action={<AddButton compact visibility="public" />}
@@ -164,30 +171,33 @@ const Body = memo(() => {
</Flexbox>
}
>
- <Suspense fallback={<SkeletonList />}>
- {isLoading ? (
- <SkeletonList />
- ) : (
- <Flexbox gap={1} paddingBlock={1}>
- {workspaceCount === 0 ? (
- searchActive ? (
- <Text
- align="center"
- fontSize={12}
- style={{ paddingBlock: 12, paddingInline: 8 }}
- type={'secondary'}
- >
- {t('pageList.noResults')}
- </Text>
- ) : (
- renderEmptyCreate('public')
- )
+ <AsyncBoundary
+ data={data}
+ error={error}
+ errorVariant={'inline'}
+ isLoading={isLoading}
+ loading={<SkeletonList />}
+ onRetry={() => mutate()}
+ >
+ <Flexbox gap={1} paddingBlock={1}>
+ {workspaceCount === 0 ? (
+ searchActive ? (
+ <Text
+ align="center"
+ fontSize={12}
+ style={{ paddingBlock: 12, paddingInline: 8 }}
+ type={'secondary'}
+ >
+ {t('pageList.noResults')}
+ </Text>
) : (
- <List visibility="workspace" />
- )}
- </Flexbox>
- )}
- </Suspense>
+ renderEmptyCreate('public')
+ )
+ ) : (
+ <List visibility="workspace" />
+ )}
+ </Flexbox>
+ </AsyncBoundary>
</AccordionItem>
</Accordion>
) : (
@@ -210,15 +220,18 @@ const Body = memo(() => {
</Flexbox>
}
>
- <Suspense fallback={<SkeletonList />}>
- {isLoading ? (
- <SkeletonList />
- ) : (
- <Flexbox gap={1} paddingBlock={1}>
- {filteredDocumentsCount === 0 ? <PageEmpty search={searchActive} /> : <List />}
- </Flexbox>
- )}
- </Suspense>
+ <AsyncBoundary
+ data={data}
+ error={error}
+ errorVariant={'inline'}
+ isLoading={isLoading}
+ loading={<SkeletonList />}
+ onRetry={() => mutate()}
+ >
+ <Flexbox gap={1} paddingBlock={1}>
+ {filteredDocumentsCount === 0 ? <PageEmpty search={searchActive} /> : <List />}
+ </Flexbox>
+ </AsyncBoundary>
</AccordionItem>
</Accordion>
)}
diff --git a/src/features/ServiceModel/ModelAssignmentsForm.tsx b/src/features/ServiceModel/ModelAssignmentsForm.tsx
index 8fda96653f1..5ff4c042580 100644
--- a/src/features/ServiceModel/ModelAssignmentsForm.tsx
+++ b/src/features/ServiceModel/ModelAssignmentsForm.tsx
@@ -9,6 +9,7 @@ import { Loader2Icon } from 'lucide-react';
import { memo, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncError from '@/components/AsyncError';
import { FORM_STYLE } from '@/const/layoutTokens';
import ModelSelect from '@/features/ModelSelect';
import { usePermission } from '@/hooks/usePermission';
@@ -50,10 +51,18 @@ const ModelAssignmentsForm = memo(() => {
(s) => [settingsSelectors.defaultAgent(s), settingsSelectors.currentSystemAgent(s)],
isEqual,
);
- const [updateDefaultAgent, updateSystemAgent, isUserStateInit] = useUserStore((s) => [
+ const [
+ updateDefaultAgent,
+ updateSystemAgent,
+ isUserStateInit,
+ isUserStateInitError,
+ refreshUserState,
+ ] = useUserStore((s) => [
s.updateDefaultAgent,
s.updateSystemAgent,
s.isUserStateInit,
+ s.isUserStateInitError,
+ s.refreshUserState,
]);
const [loadingKey, setLoadingKey] = useState<LoadingKey>();
@@ -61,7 +70,19 @@ const ModelAssignmentsForm = memo(() => {
if (loadingKey === 'defaultAgent') setLoadingKey(undefined);
}, [defaultAgent.config.model, defaultAgent.config.provider, loadingKey]);
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 8 }} title={false} />;
+ if (!isUserStateInit) {
+ // A failed user-state init must show error + Retry, not a permanent skeleton
+ // (LOBE-11118).
+ if (isUserStateInitError)
+ return (
+ <AsyncError
+ error={isUserStateInitError}
+ variant={'block'}
+ onRetry={() => refreshUserState()}
+ />
+ );
+ return <Skeleton active paragraph={{ rows: 8 }} title={false} />;
+ }
const updateDefaultAgentModel = async ({
model,
diff --git a/src/hooks/useFetchAgentList.ts b/src/hooks/useFetchAgentList.ts
index d43a08d79d0..5728e3a2563 100644
--- a/src/hooks/useFetchAgentList.ts
+++ b/src/hooks/useFetchAgentList.ts
@@ -4,16 +4,20 @@ import { authSelectors } from '@/store/user/slices/auth/selectors';
/**
* Hook to fetch agent list
- * @returns isValidating - true when background revalidation is in progress (has cached data but fetching new)
+ * @returns isRevalidating - true when background revalidation is in progress (has cached data but fetching new)
+ * @returns error - the thrown SWR error, so consumers can surface a failure state instead of a permanent skeleton
+ * @returns mutate - retry the same request (wired into the error state's Retry)
*/
export const useFetchAgentList = () => {
const isLogin = useUserStore(authSelectors.isLogin);
const useFetchAgentListHook = useHomeStore((s) => s.useFetchAgentList);
- const { isValidating, data } = useFetchAgentListHook(isLogin);
+ const { isValidating, data, error, mutate } = useFetchAgentListHook(isLogin);
- // isRevalidating: has cached data, updating in background
return {
+ error,
+ // isRevalidating: has cached data, updating in background
isRevalidating: isValidating && !!data,
+ mutate,
};
};
diff --git a/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx b/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx
index 56b03a52a9f..f4d75bc3a01 100644
--- a/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx
+++ b/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx
@@ -1,7 +1,9 @@
'use client';
+import { Center } from '@lobehub/ui';
import type { ComponentType } from 'react';
+import AsyncError from '@/components/AsyncError';
import type { GenerationBatch } from '@/types/generation';
export interface GenerationWorkspaceContentSelectors {
@@ -32,10 +34,22 @@ const Content = ({
const activeTopicId = useStore(selectors.activeGenerationTopicId);
const useFetchGenerationBatches = useStore((s: any) => s.useFetchGenerationBatches);
const isCurrentGenerationTopicLoaded = useStore(selectors.isCurrentGenerationTopicLoaded);
- useFetchGenerationBatches(activeTopicId);
+ // Keep `error` / `mutate`: the topic's "loaded" flag is `Array.isArray(map[topicId])`,
+ // written only on success, so a failed batch fetch would otherwise stick on the
+ // skeleton forever with no retry (LOBE-11208).
+ const { error, mutate } = useFetchGenerationBatches(activeTopicId);
const currentBatches = useStore(selectors.currentGenerationBatches);
const hasGenerations = currentBatches && currentBatches.length > 0;
+ // Error gated ahead of the skeleton (loaded flag stays false on failure).
+ if (error && !isCurrentGenerationTopicLoaded) {
+ return (
+ <Center flex={1} padding={24} width={'100%'}>
+ <AsyncError error={error} variant={'block'} onRetry={() => mutate()} />
+ </Center>
+ );
+ }
+
if (!isCurrentGenerationTopicLoaded) {
return <SkeletonList embedInput={embedInput} />;
}
diff --git a/src/routes/(main)/community/(detail)/workspace/index.tsx b/src/routes/(main)/community/(detail)/workspace/index.tsx
index 95b39168bf6..fadf035033f 100644
--- a/src/routes/(main)/community/(detail)/workspace/index.tsx
+++ b/src/routes/(main)/community/(detail)/workspace/index.tsx
@@ -1,8 +1,10 @@
'use client';
+import { Center } from '@lobehub/ui';
import { memo, useCallback, useMemo } from 'react';
import { useCommunityWorkspaceProfile } from '@/business/client/hooks/useCommunityWorkspaceProfile';
+import AsyncError from '@/components/AsyncError';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useDiscoverStore } from '@/store/discover';
import type { DiscoverUserProfile } from '@/types/discover';
@@ -39,6 +41,7 @@ const WorkspaceDetailPage = memo<WorkspaceDetailPageProps>(({ mobile }) => {
const useUserProfile = useDiscoverStore((s) => s.useUserProfile);
const {
data,
+ error: userProfileError,
isLoading: isUserProfileLoading,
mutate,
} = useUserProfile({
@@ -149,7 +152,23 @@ const WorkspaceDetailPage = memo<WorkspaceDetailPageProps>(({ mobile }) => {
]);
if ((isWorkspaceProfileLoading || isUserProfileLoading) && !fallbackProfile) return <Loading />;
- if (!contextConfig) return <NotFound />;
+ if (!contextConfig) {
+ // A transient profile fetch failure must not masquerade as "workspace not
+ // found" — offer Reload. Only a resolved-empty profile is a real 404
+ // (LOBE-11223). `fallbackProfile` would have yielded a contextConfig, so
+ // reaching here with an error means we have nothing to show.
+ if (userProfileError)
+ return (
+ <Center flex={1} padding={48} width={'100%'}>
+ <AsyncError
+ error={userProfileError}
+ variant={'page'}
+ onRetry={() => handleRefreshWorkspaceProfile()}
+ />
+ </Center>
+ );
+ return <NotFound />;
+ }
return (
<WorkspaceDetailProvider config={contextConfig}>
diff --git a/src/routes/(main)/community/(list)/(home)/index.tsx b/src/routes/(main)/community/(list)/(home)/index.tsx
index d6ecaa4a8cd..446d4f8c7f5 100644
--- a/src/routes/(main)/community/(list)/(home)/index.tsx
+++ b/src/routes/(main)/community/(list)/(home)/index.tsx
@@ -3,46 +3,74 @@
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import { useDiscoverStore } from '@/store/discover';
import { AssistantSorts, McpSorts } from '@/types/discover';
+import ListLoading from '../../components/ListLoading';
import Title from '../../components/Title';
import AssistantList from '../agent/features/List';
import McpList from '../mcp/features/List';
import CreatorRewardBanner from './features/CreatorRewardBanner';
-import Loading from './loading';
const HomePage = memo(() => {
const { t } = useTranslation('discover');
const useAssistantList = useDiscoverStore((s) => s.useAssistantList);
const useMcpList = useDiscoverStore((s) => s.useFetchMcpList);
- const { data: assistantList, isLoading: assistantLoading } = useAssistantList({
+ const {
+ data: assistantList,
+ isLoading: assistantLoading,
+ error: assistantError,
+ mutate: refetchAssistants,
+ } = useAssistantList({
page: 1,
pageSize: 12,
sort: AssistantSorts.Recommended,
});
- const { data: mcpList, isLoading: pluginLoading } = useMcpList({
+ const {
+ data: mcpList,
+ isLoading: pluginLoading,
+ error: mcpError,
+ mutate: refetchMcp,
+ } = useMcpList({
page: 1,
pageSize: 12,
sort: McpSorts.Recommended,
});
- if (assistantLoading || pluginLoading || !assistantList || !mcpList) return <Loading />;
-
+ // Gate each section independently so a failure in one featured list surfaces a
+ // Retry there instead of leaving the whole page on a permanent skeleton
+ // (LOBE-11223).
return (
<>
<CreatorRewardBanner />
<Title more={t('home.more')} moreLink={'/community/agent'}>
{t('home.featuredAssistants')}
</Title>
- <AssistantList data={assistantList.items} rows={4} />
+ <AsyncBoundary
+ data={assistantList}
+ error={assistantError}
+ isLoading={assistantLoading}
+ loading={<ListLoading length={8} rows={4} />}
+ onRetry={() => refetchAssistants()}
+ >
+ <AssistantList data={assistantList?.items ?? []} rows={4} />
+ </AsyncBoundary>
<div />
<Title more={t('home.more')} moreLink={'/community/mcp'}>
{t('home.featuredTools')}
</Title>
- <McpList data={mcpList.items} rows={4} />
+ <AsyncBoundary
+ data={mcpList}
+ error={mcpError}
+ isLoading={pluginLoading}
+ loading={<ListLoading length={8} rows={4} />}
+ onRetry={() => refetchMcp()}
+ >
+ <McpList data={mcpList?.items ?? []} rows={4} />
+ </AsyncBoundary>
</>
);
});
diff --git a/src/routes/(main)/community/(list)/agent/index.tsx b/src/routes/(main)/community/(list)/agent/index.tsx
index 20c6a46787f..9890410a985 100644
--- a/src/routes/(main)/community/(list)/agent/index.tsx
+++ b/src/routes/(main)/community/(list)/agent/index.tsx
@@ -35,8 +35,9 @@ const AssistantPage = memo(() => {
data={data}
empty={<AssistantEmpty />}
error={error}
+ errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading || !data}
+ isLoading={isLoading}
loading={<Loading />}
onRetry={() => mutate()}
>
diff --git a/src/routes/(main)/community/(list)/mcp/index.tsx b/src/routes/(main)/community/(list)/mcp/index.tsx
index f446b580ec3..9ddcc238a70 100644
--- a/src/routes/(main)/community/(list)/mcp/index.tsx
+++ b/src/routes/(main)/community/(list)/mcp/index.tsx
@@ -33,8 +33,9 @@ const McpPage = memo(() => {
data={data}
empty={<McpEmpty />}
error={error}
+ errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading || !data}
+ isLoading={isLoading}
loading={<Loading />}
onRetry={() => mutate()}
>
diff --git a/src/routes/(main)/community/(list)/model/index.tsx b/src/routes/(main)/community/(list)/model/index.tsx
index 5cb5741d636..e1995c3af0e 100644
--- a/src/routes/(main)/community/(list)/model/index.tsx
+++ b/src/routes/(main)/community/(list)/model/index.tsx
@@ -33,8 +33,9 @@ const ModelPage = memo<{ mobile?: boolean }>(() => {
data={data}
empty={<ModelEmpty />}
error={error}
+ errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading || !data}
+ isLoading={isLoading}
loading={<Loading />}
onRetry={() => mutate()}
>
diff --git a/src/routes/(main)/community/(list)/provider/index.tsx b/src/routes/(main)/community/(list)/provider/index.tsx
index 3bb2cc4078e..fe303d1d668 100644
--- a/src/routes/(main)/community/(list)/provider/index.tsx
+++ b/src/routes/(main)/community/(list)/provider/index.tsx
@@ -32,8 +32,9 @@ const ProviderPage = memo(() => {
data={data}
empty={<ProviderEmpty />}
error={error}
+ errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading || !data}
+ isLoading={isLoading}
loading={<Loading />}
onRetry={() => mutate()}
>
diff --git a/src/routes/(main)/community/(list)/skill/index.tsx b/src/routes/(main)/community/(list)/skill/index.tsx
index e0367c36ec8..7e87e9c4bb1 100644
--- a/src/routes/(main)/community/(list)/skill/index.tsx
+++ b/src/routes/(main)/community/(list)/skill/index.tsx
@@ -33,8 +33,9 @@ const SkillPage = memo(() => {
data={data}
empty={<SkillEmpty />}
error={error}
+ errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading || !data}
+ isLoading={isLoading}
loading={<Loading />}
onRetry={() => mutate()}
>
diff --git a/src/routes/(main)/home/features/AgentSelect/AgentList.tsx b/src/routes/(main)/home/features/AgentSelect/AgentList.tsx
index 6abaae03d8f..c1a006c332d 100644
--- a/src/routes/(main)/home/features/AgentSelect/AgentList.tsx
+++ b/src/routes/(main)/home/features/AgentSelect/AgentList.tsx
@@ -6,6 +6,7 @@ import { createStaticStyles, cssVar } from 'antd-style';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR } from '@/const/meta';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import { useAgentStore } from '@/store/agent';
@@ -34,6 +35,9 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
interface AgentListProps {
activeAgentId: string;
+ /** Thrown error from the agent-list SWR — surfaced as a failure state. */
+ error?: unknown;
+ onRetry?: () => void;
onSelect: (agentId: string) => void;
}
@@ -44,7 +48,7 @@ interface AgentRow {
title: string;
}
-const AgentList = memo<AgentListProps>(({ activeAgentId, onSelect }) => {
+const AgentList = memo<AgentListProps>(({ activeAgentId, error, onRetry, onSelect }) => {
const { t } = useTranslation('chat');
const isInit = useHomeStore(homeAgentListSelectors.isAgentListInit);
@@ -87,45 +91,54 @@ const AgentList = memo<AgentListProps>(({ activeAgentId, onSelect }) => {
return out;
}, [inboxAgentId, inboxMeta, allAgents, t]);
- if (!isInit) return <SkeletonList rows={6} style={{ padding: 8 }} />;
-
+ // Error gated ahead of the skeleton so a failed list fetch shows Retry instead
+ // of a permanent skeleton (`isAgentListInit` only flips on success — LOBE-11079).
return (
- <Flexbox
- className={styles.list}
- gap={2}
- style={{ maxHeight: 360, overflowY: 'auto', width: '100%' }}
+ <AsyncBoundary
+ data={isInit ? allAgents : undefined}
+ error={error}
+ errorVariant={'block'}
+ isLoading={!isInit && !error}
+ loading={<SkeletonList rows={6} style={{ padding: 8 }} />}
+ onRetry={onRetry}
>
- {rows.map((row) => {
- const isActive = row.id === activeAgentId;
- return (
- <Block
- clickable
- horizontal
- align={'center'}
- className={`${styles.item} ${isActive ? styles.active : ''}`}
- gap={8}
- key={row.id}
- variant={'borderless'}
- onClick={() => onSelect(row.id)}
- >
- <Avatar
- avatar={row.avatar || DEFAULT_AVATAR}
- background={row.backgroundColor}
- shape={'square'}
- size={24}
- />
- <Text
- ellipsis
- color={isActive ? cssVar.colorText : cssVar.colorTextSecondary}
- style={{ flex: 1 }}
- weight={isActive ? 600 : 500}
+ <Flexbox
+ className={styles.list}
+ gap={2}
+ style={{ maxHeight: 360, overflowY: 'auto', width: '100%' }}
+ >
+ {rows.map((row) => {
+ const isActive = row.id === activeAgentId;
+ return (
+ <Block
+ clickable
+ horizontal
+ align={'center'}
+ className={`${styles.item} ${isActive ? styles.active : ''}`}
+ gap={8}
+ key={row.id}
+ variant={'borderless'}
+ onClick={() => onSelect(row.id)}
>
- {row.title}
- </Text>
- </Block>
- );
- })}
- </Flexbox>
+ <Avatar
+ avatar={row.avatar || DEFAULT_AVATAR}
+ background={row.backgroundColor}
+ shape={'square'}
+ size={24}
+ />
+ <Text
+ ellipsis
+ color={isActive ? cssVar.colorText : cssVar.colorTextSecondary}
+ style={{ flex: 1 }}
+ weight={isActive ? 600 : 500}
+ >
+ {row.title}
+ </Text>
+ </Block>
+ );
+ })}
+ </Flexbox>
+ </AsyncBoundary>
);
});
diff --git a/src/routes/(main)/home/features/AgentSelect/index.tsx b/src/routes/(main)/home/features/AgentSelect/index.tsx
index 5e6691baadf..94216fca888 100644
--- a/src/routes/(main)/home/features/AgentSelect/index.tsx
+++ b/src/routes/(main)/home/features/AgentSelect/index.tsx
@@ -39,8 +39,10 @@ const AgentSelect = memo(() => {
const { t } = useTranslation(['chat', 'common']);
const [open, setOpen] = useState(false);
- // Trigger fetching the home agent list so the popover content is ready when opened.
- useFetchAgentList();
+ // Trigger fetching the home agent list so the popover content is ready when
+ // opened. Keep `error` / `mutate` so a failed list fetch shows a Retry state
+ // in the popover instead of a permanent skeleton (LOBE-11079).
+ const { error: agentListError, mutate: refetchAgentList } = useFetchAgentList();
const isLoading = useAgentStore(agentSelectors.isAgentConfigLoading);
const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
@@ -106,12 +108,19 @@ const AgentSelect = memo(() => {
return (
<Popover
classNames={{ trigger: styles.trigger }}
- content={<AgentList activeAgentId={displayAgentId} onSelect={handleSelect} />}
nativeButton={false}
open={open}
placement="bottomLeft"
styles={{ content: { padding: 0, width: 360 } }}
trigger="click"
+ content={
+ <AgentList
+ activeAgentId={displayAgentId}
+ error={agentListError}
+ onRetry={() => refetchAgentList()}
+ onSelect={handleSelect}
+ />
+ }
onOpenChange={setOpen}
>
<Block
diff --git a/src/routes/(main)/home/features/Recents/List.tsx b/src/routes/(main)/home/features/Recents/List.tsx
index 50d31db3726..385e275dc91 100644
--- a/src/routes/(main)/home/features/Recents/List.tsx
+++ b/src/routes/(main)/home/features/Recents/List.tsx
@@ -3,6 +3,7 @@ import { MoreHorizontalIcon } from 'lucide-react';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import { taskDetailPath } from '@/features/AgentTasks/shared/taskDetailPath';
import NavItem from '@/features/NavPanel/components/NavItem';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
@@ -15,7 +16,13 @@ import { homeRecentSelectors } from '@/store/home/selectors';
import AllRecentsDrawer from './AllRecentsDrawer';
import RecentListItem from './Item';
-const RecentsList = memo(() => {
+interface RecentsListProps {
+ /** Thrown error from the recents SWR — surfaced as a failure state. */
+ error?: unknown;
+ onRetry?: () => void;
+}
+
+const RecentsList = memo<RecentsListProps>(({ error, onRetry }) => {
const { t } = useTranslation('chat');
const recents = useHomeStore(homeRecentSelectors.recents);
const isInit = useHomeStore(homeRecentSelectors.isRecentsInit);
@@ -37,26 +44,34 @@ const RecentsList = memo(() => {
return taskDetailPath(taskId, item.agentId ?? undefined);
}, []);
- if (!isInit) {
- return <SkeletonList rows={3} />;
- }
-
+ // Error gated ahead of the skeleton so a failed recents fetch shows Retry
+ // instead of a permanent skeleton (`isRecentsInit` only flips on success —
+ // LOBE-11079).
return (
- <Flexbox gap={1}>
- {displayItems.map((item) => (
- <WorkspaceLink
- key={`${item.type}-${item.id}`}
- style={{ color: 'inherit', textDecoration: 'none' }}
- to={getRecentRoute(item)}
- >
- <RecentListItem {...item} />
- </WorkspaceLink>
- ))}
- {hasMore && (
- <NavItem icon={MoreHorizontalIcon} title={t('input.more')} onClick={openDrawer} />
- )}
- <AllRecentsDrawer open={drawerOpen} onClose={closeDrawer} />
- </Flexbox>
+ <AsyncBoundary
+ data={isInit ? recents : undefined}
+ error={error}
+ errorVariant={'inline'}
+ isLoading={!isInit && !error}
+ loading={<SkeletonList rows={3} />}
+ onRetry={onRetry}
+ >
+ <Flexbox gap={1}>
+ {displayItems.map((item) => (
+ <WorkspaceLink
+ key={`${item.type}-${item.id}`}
+ style={{ color: 'inherit', textDecoration: 'none' }}
+ to={getRecentRoute(item)}
+ >
+ <RecentListItem {...item} />
+ </WorkspaceLink>
+ ))}
+ {hasMore && (
+ <NavItem icon={MoreHorizontalIcon} title={t('input.more')} onClick={openDrawer} />
+ )}
+ <AllRecentsDrawer open={drawerOpen} onClose={closeDrawer} />
+ </Flexbox>
+ </AsyncBoundary>
);
});
diff --git a/src/routes/(main)/home/features/Recents/index.tsx b/src/routes/(main)/home/features/Recents/index.tsx
index 981d90e9e14..5087d0e095a 100644
--- a/src/routes/(main)/home/features/Recents/index.tsx
+++ b/src/routes/(main)/home/features/Recents/index.tsx
@@ -44,7 +44,9 @@ const Recents = memo<RecentsProps>(({ itemKey }) => {
const recents = useHomeStore(homeRecentSelectors.recents);
const isInit = useHomeStore(homeRecentSelectors.isRecentsInit);
const isLogin = useUserStore(authSelectors.isLogin);
- const { isRevalidating } = useInitRecents();
+ // Keep `error` / `mutate` so a failed recents fetch surfaces a Retry state
+ // instead of a permanent skeleton (LOBE-11079).
+ const { error, isRevalidating, mutate } = useInitRecents();
const activeWorkspaceId = useActiveWorkspaceId();
const recentPageSize = useGlobalStore(systemStatusSelectors.recentPageSize);
@@ -159,7 +161,7 @@ const Recents = memo<RecentsProps>(({ itemKey }) => {
}
>
<Suspense fallback={<SkeletonList rows={3} />}>
- <RecentsList />
+ <RecentsList error={error} onRetry={() => mutate()} />
</Suspense>
</AccordionItem>
);
diff --git a/src/routes/(main)/settings/advanced/index.tsx b/src/routes/(main)/settings/advanced/index.tsx
index 24d5d454be3..1302ffbaac9 100644
--- a/src/routes/(main)/settings/advanced/index.tsx
+++ b/src/routes/(main)/settings/advanced/index.tsx
@@ -10,6 +10,7 @@ import { Loader2Icon } from 'lucide-react';
import { memo, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncError from '@/components/AsyncError';
import { FORM_STYLE } from '@/const/layoutTokens';
import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
import { autoUpdateService } from '@/services/electron/autoUpdate';
@@ -35,11 +36,14 @@ const Page = memo(() => {
const defaultAgentGatewayModeEnabled = useUserStore(
(s) => settingsSelectors.defaultAgentConfig(s).chatConfig?.disableGatewayMode !== true,
);
- const [setSettings, updateDefaultAgent, isUserStateInit] = useUserStore((s) => [
- s.setSettings,
- s.updateDefaultAgent,
- s.isUserStateInit,
- ]);
+ const [setSettings, updateDefaultAgent, isUserStateInit, isUserStateInitError, refreshUserState] =
+ useUserStore((s) => [
+ s.setSettings,
+ s.updateDefaultAgent,
+ s.isUserStateInit,
+ s.isUserStateInitError,
+ s.refreshUserState,
+ ]);
const [loading, setLoading] = useState(false);
const [
@@ -91,7 +95,19 @@ const Page = memo(() => {
[updateDefaultAgent],
);
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isUserStateInit) {
+ // A failed user-state init must show error + Retry, not a permanent skeleton
+ // (LOBE-11139).
+ if (isUserStateInitError)
+ return (
+ <AsyncError
+ error={isUserStateInitError}
+ variant={'block'}
+ onRetry={() => refreshUserState()}
+ />
+ );
+ return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ }
const advancedGroup: FormGroupItemType = {
children: [
diff --git a/src/routes/(main)/settings/provider/(list)/ProviderGrid/index.tsx b/src/routes/(main)/settings/provider/(list)/ProviderGrid/index.tsx
index 8536b95732e..b20c2db1397 100644
--- a/src/routes/(main)/settings/provider/(list)/ProviderGrid/index.tsx
+++ b/src/routes/(main)/settings/provider/(list)/ProviderGrid/index.tsx
@@ -5,6 +5,7 @@ import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
import Card from './Card';
@@ -27,32 +28,43 @@ const List = memo((props: ListProps) => {
isEqual,
);
const [initAiProviderList] = useAiInfraStore((s) => [s.initAiProviderList]);
+ // Own the same list fetch (SWR-deduped with ProviderMenu) so a failed load
+ // shows error + Retry here too, instead of a permanent skeleton grid
+ // (`initAiProviderList` only flips on success — LOBE-11117).
+ const useFetchAiProviderList = useAiInfraStore((s) => s.useFetchAiProviderList);
+ const { error, mutate } = useFetchAiProviderList();
- if (!initAiProviderList)
- return (
- <Flexbox gap={24} paddingBlock={'0 16px'}>
- <Flexbox horizontal align={'center'} gap={4}>
- <Text strong style={{ fontSize: 16 }}>
- {t('list.title.enabled')}
- </Text>
- </Flexbox>
- <Grid gap={16} rows={3}>
- {loadingArr.map((item) => (
- <Card
- loading
- enabled={false}
- id={item}
- key={item}
- source={'builtin'}
- onProviderSelect={onProviderSelect}
- />
- ))}
- </Grid>
+ const skeleton = (
+ <Flexbox gap={24} paddingBlock={'0 16px'}>
+ <Flexbox horizontal align={'center'} gap={4}>
+ <Text strong style={{ fontSize: 16 }}>
+ {t('list.title.enabled')}
+ </Text>
</Flexbox>
- );
+ <Grid gap={16} rows={3}>
+ {loadingArr.map((item) => (
+ <Card
+ loading
+ enabled={false}
+ id={item}
+ key={item}
+ source={'builtin'}
+ onProviderSelect={onProviderSelect}
+ />
+ ))}
+ </Grid>
+ </Flexbox>
+ );
return (
- <>
+ <AsyncBoundary
+ data={initAiProviderList ? true : undefined}
+ error={error}
+ errorVariant={'page'}
+ isLoading={!initAiProviderList && !error}
+ loading={skeleton}
+ onRetry={() => mutate()}
+ >
<Flexbox gap={24}>
<Flexbox horizontal align={'center'} gap={8}>
<Text strong style={{ fontSize: 18 }}>
@@ -94,7 +106,7 @@ const List = memo((props: ListProps) => {
))}
</Grid>
</Flexbox>
- </>
+ </AsyncBoundary>
);
});
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/index.tsx b/src/routes/(main)/settings/provider/ProviderMenu/index.tsx
index 34c776c32e7..4995194fb0a 100644
--- a/src/routes/(main)/settings/provider/ProviderMenu/index.tsx
+++ b/src/routes/(main)/settings/provider/ProviderMenu/index.tsx
@@ -7,6 +7,7 @@ import { type ReactNode } from 'react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncBoundary from '@/components/AsyncBoundary';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import { useAiInfraStore } from '@/store/aiInfra/store';
@@ -21,13 +22,7 @@ interface ProviderMenuProps {
const Layout = memo(({ children, mobile }: ProviderMenuProps) => {
const { t } = useTranslation('modelProvider');
- const [providerSearchKeyword, useFetchAiProviderList] = useAiInfraStore((s) => [
- s.providerSearchKeyword,
- s.useFetchAiProviderList,
- s.initAiProviderList,
- ]);
-
- useFetchAiProviderList();
+ const providerSearchKeyword = useAiInfraStore((s) => s.providerSearchKeyword);
const width = mobile ? undefined : 280;
return (
@@ -95,18 +90,31 @@ const ProviderMenu = ({
mobile?: boolean;
onProviderSelect?: (providerKey: string) => void;
}) => {
- const [initAiProviderList, providerSearchKeyword] = useAiInfraStore((s) => [
- s.initAiProviderList,
- s.providerSearchKeyword,
- ]);
-
- let Content = <ProviderList mobile={mobile} onProviderSelect={onProviderSelect} />;
+ const [initAiProviderList, providerSearchKeyword, useFetchAiProviderList] = useAiInfraStore(
+ (s) => [s.initAiProviderList, s.providerSearchKeyword, s.useFetchAiProviderList],
+ );
- // loading
- if (!initAiProviderList) Content = <SkeletonList />;
+ // Own the provider-list fetch here so a failed load surfaces error + Retry
+ // instead of a permanent skeleton — `initAiProviderList` only flips on success
+ // (LOBE-11117).
+ const { error, mutate } = useFetchAiProviderList();
- // search
- if (!!providerSearchKeyword) Content = <SearchResult onProviderSelect={onProviderSelect} />;
+ // Search overrides everything (matches prior behavior); otherwise gate the
+ // list on load/error via AsyncBoundary.
+ const Content = providerSearchKeyword ? (
+ <SearchResult onProviderSelect={onProviderSelect} />
+ ) : (
+ <AsyncBoundary
+ data={initAiProviderList ? true : undefined}
+ error={error}
+ errorVariant={'page'}
+ isLoading={!initAiProviderList && !error}
+ loading={<SkeletonList />}
+ onRetry={() => mutate()}
+ >
+ <ProviderList mobile={mobile} onProviderSelect={onProviderSelect} />
+ </AsyncBoundary>
+ );
return <Layout mobile={mobile}>{Content}</Layout>;
};
diff --git a/src/routes/(main)/settings/skill/features/SkillList.tsx b/src/routes/(main)/settings/skill/features/SkillList.tsx
index 2ae0ce48ba5..42f14fc27b2 100644
--- a/src/routes/(main)/settings/skill/features/SkillList.tsx
+++ b/src/routes/(main)/settings/skill/features/SkillList.tsx
@@ -20,6 +20,7 @@ import type React from 'react';
import { memo, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AsyncError from '@/components/AsyncError';
import { useFetchInstalledPlugins } from '@/hooks/useFetchInstalledPlugins';
import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';
import { useToolStore } from '@/store/tool';
@@ -122,10 +123,21 @@ const SkillList = memo<SkillListProps>(
]);
useFetchInstalledPlugins();
- useFetchLobehubSkillConnections(isLobehubSkillEnabled);
- useFetchUserComposioConnections(isComposioEnabled);
- useFetchAgentSkills(true);
- useFetchUninstalledBuiltinTools(true);
+ // Keep each SWR handle so a failed skill fetch surfaces error + Retry instead
+ // of a fake-empty list (each hook syncs into the store only on success —
+ // LOBE-11124).
+ const lobehubSkillsSWR = useFetchLobehubSkillConnections(isLobehubSkillEnabled);
+ const composioSWR = useFetchUserComposioConnections(isComposioEnabled);
+ const agentSkillsSWR = useFetchAgentSkills(true);
+ const builtinToolsSWR = useFetchUninstalledBuiltinTools(true);
+ const skillsError =
+ lobehubSkillsSWR.error ?? composioSWR.error ?? agentSkillsSWR.error ?? builtinToolsSWR.error;
+ const reloadSkills = () => {
+ void lobehubSkillsSWR.mutate();
+ void composioSWR.mutate();
+ void agentSkillsSWR.mutate();
+ void builtinToolsSWR.mutate();
+ };
// Load custom connectors (new connector store) so user-added OAuth MCP
// connectors appear in the Connectors tab list.
@@ -329,6 +341,16 @@ const SkillList = memo<SkillListProps>(
communityMCPs.length > 0 ||
customMCPs.length > 0;
+ // A failed fetch must read as a failure with Retry, never as the "no skills"
+ // empty (error gated ahead of empty — LOBE-11124).
+ if (skillsError && !hasAnySkills) {
+ return (
+ <Center className={styles.container} paddingBlock={48}>
+ <AsyncError error={skillsError} variant={'block'} onRetry={reloadSkills} />
+ </Center>
+ );
+ }
+
if (!hasAnySkills) {
return (
<Center className={styles.container} paddingBlock={48}>
diff --git a/src/routes/onboarding/features/ResponseLanguageStep.tsx b/src/routes/onboarding/features/ResponseLanguageStep.tsx
index 658e54eb04d..036507e2632 100644
--- a/src/routes/onboarding/features/ResponseLanguageStep.tsx
+++ b/src/routes/onboarding/features/ResponseLanguageStep.tsx
@@ -32,14 +32,27 @@ const ResponseLanguageStep = memo<ResponseLanguageStepProps>(({ onBack, onNext }
i18n.resolvedLanguage || i18n.language || navigator.language,
);
const [isNavigating, setIsNavigating] = useState(false);
+ const [hasError, setHasError] = useState(false);
const isNavigatingRef = useRef(false);
const handleNext = useCallback(async () => {
if (isNavigatingRef.current) return;
isNavigatingRef.current = true;
setIsNavigating(true);
- await setSettings({ general: { responseLanguage: value } });
- await onNext();
+ setHasError(false);
+ try {
+ // This write is the sole gate for the whole onboarding flow
+ // (`commonStepsCompleted` keys off `responseLanguage`), so it must be able
+ // to fail: on error reset the navigating lock so the user can retry
+ // instead of being stuck with both buttons permanently disabled
+ // (LOBE-11154).
+ await setSettings({ general: { responseLanguage: value } });
+ await onNext();
+ } catch {
+ setHasError(true);
+ isNavigatingRef.current = false;
+ setIsNavigating(false);
+ }
}, [value, setSettings, onNext]);
const handleBack = useCallback(() => {
@@ -101,6 +114,11 @@ const ResponseLanguageStep = memo<ResponseLanguageStepProps>(({ onBack, onNext }
<Text style={{ fontSize: 12 }} type="secondary">
{t('responseLanguage.hint')}
</Text>
+ {hasError && (
+ <Text style={{ color: cssVar.colorError, fontSize: 12 }}>
+ {t('responseLanguage.saveFailed')}
+ </Text>
+ )}
<Flexbox horizontal justify={'flex-start'} style={{ marginTop: 32 }}>
<Button
disabled={isNavigating}
diff --git a/src/store/aiInfra/slices/aiProvider/action.ts b/src/store/aiInfra/slices/aiProvider/action.ts
index 1e981ad58b5..3eb9f1c25a0 100644
--- a/src/store/aiInfra/slices/aiProvider/action.ts
+++ b/src/store/aiInfra/slices/aiProvider/action.ts
@@ -462,7 +462,6 @@ export class AiProviderActionImpl {
opts?.enabled === false ? null : AiProviderSwrKey.fetchAiProviderList,
() => aiProviderService.getAiProviderList(),
{
- fallbackData: [],
onSuccess: (data) => {
if (!this.#get().initAiProviderList) {
this.#set(
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 6a92e0ffb83..e963778b77e 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -398,7 +398,7 @@ export const INITIAL_STATUS = {
imageTopicViewMode: 'grid' as const,
imageTopicPanelWidth: 80,
knowledgeBaseModalViewMode: 'list' as const,
- leftPanelWidth: 320,
+ leftPanelWidth: 280,
mobileShowTopic: false,
modelDetailPanelExpandedKeys: [...DEFAULT_MODEL_DETAIL_PANEL_EXPANDED_KEYS],
modelSwitchPanelGroupMode: 'byProvider',
diff --git a/src/store/task/slices/list/action.ts b/src/store/task/slices/list/action.ts
index 9c9ce0eb28a..0a1b0f01827 100644
--- a/src/store/task/slices/list/action.ts
+++ b/src/store/task/slices/list/action.ts
@@ -140,7 +140,6 @@ export class TaskListSliceActionImpl {
});
},
{
- fallbackData: { data: [], success: true },
onSuccess: (data: { data: TaskGroupItem[] }) => {
this.#set(
{ isTaskGroupListInit: true, taskGroups: data.data },
@@ -180,7 +179,6 @@ export class TaskListSliceActionImpl {
});
},
{
- fallbackData: { data: [], success: true, total: 0 },
onSuccess: (data: { data: TaskListItem[]; total: number }) => {
this.#set(
{
diff --git a/src/store/tool/slices/agentSkills/action.ts b/src/store/tool/slices/agentSkills/action.ts
index 8d950c05a2a..71f27a8984c 100644
--- a/src/store/tool/slices/agentSkills/action.ts
+++ b/src/store/tool/slices/agentSkills/action.ts
@@ -162,7 +162,6 @@ export class AgentSkillsActionImpl {
return data;
},
{
- fallbackData: [],
onSuccess: (data) => {
this.#set({ agentSkills: data }, false, n('useFetchAgentSkills'));
},
diff --git a/src/store/tool/slices/composioStore/action.ts b/src/store/tool/slices/composioStore/action.ts
index df8496e69fd..8bc2b90927a 100644
--- a/src/store/tool/slices/composioStore/action.ts
+++ b/src/store/tool/slices/composioStore/action.ts
@@ -355,7 +355,6 @@ export class ComposioStoreActionImpl {
});
},
{
- fallbackData: [],
onSuccess: (data) => {
this.#set(
produce((draft: ComposioStoreState) => {
diff --git a/src/store/tool/slices/lobehubSkillStore/action.ts b/src/store/tool/slices/lobehubSkillStore/action.ts
index 6af473f38c3..8cf3c2202df 100644
--- a/src/store/tool/slices/lobehubSkillStore/action.ts
+++ b/src/store/tool/slices/lobehubSkillStore/action.ts
@@ -320,7 +320,6 @@ export class LobehubSkillStoreActionImpl {
});
},
{
- fallbackData: [],
onSuccess: (data) => {
if (data.length > 0) {
this.#set(
diff --git a/src/store/user/slices/common/action.ts b/src/store/user/slices/common/action.ts
index 9f6895997d9..d182c0f8a4c 100644
--- a/src/store/user/slices/common/action.ts
+++ b/src/store/user/slices/common/action.ts
@@ -107,6 +107,9 @@ export class CommonActionImpl {
() => userService.getUserState(),
{
onError: (error) => {
+ // Record the init failure so gated tabs (Advanced / ServiceModel) can
+ // render error + Retry instead of a permanent skeleton (LOBE-11118/11139).
+ this.#set({ isUserStateInitError: error }, false, n('initUserState/error'));
options?.onError?.(error);
},
onSuccess: (data) => {
@@ -150,6 +153,7 @@ export class CommonActionImpl {
isUserCanEnableTrace: data.canEnableTrace,
isUserHasConversation: data.hasConversation,
isUserStateInit: true,
+ isUserStateInitError: undefined,
agentOnboarding: data.agentOnboarding,
onboarding: data.onboarding,
preference,
diff --git a/src/store/user/slices/common/initialState.ts b/src/store/user/slices/common/initialState.ts
index 90c45f853c0..8ba8e9ca009 100644
--- a/src/store/user/slices/common/initialState.ts
+++ b/src/store/user/slices/common/initialState.ts
@@ -8,6 +8,8 @@ export interface CommonState {
isUserCanEnableTrace: boolean;
isUserHasConversation: boolean;
isUserStateInit: boolean;
+ /** Thrown error from the user-state init fetch — lets tabs show error + Retry instead of a permanent skeleton. */
+ isUserStateInitError?: unknown;
referralStatus?: ReferralStatusString;
subscriptionPlan?: Plans;
}