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.

♻️ refactor(skeleton): migrate to the base-ui Skeleton and make the route skeleton the only loading layer

Innei9c81af8ad21e
diff --git a/.agents/acceptance/common-mistakes.md b/.agents/acceptance/common-mistakes.md
index 086ff716551..ba5f04d9c34 100644
--- a/.agents/acceptance/common-mistakes.md
+++ b/.agents/acceptance/common-mistakes.md
@@ -1009,14 +1009,14 @@ not.
**What happened.** A round's `plan[]` was filled with the agent's task list —
"find the root cause", "fix it and add a regression test", "record the flows" —
-instead of acceptance criteria. `plan[]` is the *frozen check plan*: every item
+instead of acceptance criteria. `plan[]` is the _frozen check plan_: every item
is a check that must be executed by a case with the same `id`, and a planned
item with no case renders as **未执行** rather than vanishing. The three items
had no `id`, so the server numbered them `case-1..3` and three permanent
`not executed` gate checks appeared on the user's acceptance board — gates that
can never pass, on work that was in fact complete.
-**Rule.** `plan[]` holds only what the *user* would accept or reject, each with
+**Rule.** `plan[]` holds only what the _user_ would accept or reject, each with
a stable `id` that a case in the same round fulfills. Your own steps —
investigate, fix, test, record — are not checks. If a round has one criterion,
`plan[]` has exactly one item.
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.md
index 439835a2c71..0c529bb735c 100644
--- a/.agents/acceptance/probe-mock-patterns.md
+++ b/.agents/acceptance/probe-mock-patterns.md
@@ -594,6 +594,39 @@ identify the fallback by a row count — it is shaped per navKey now
(`NAV_SKELETON_SHAPES`), so memory/discover render header plus a nav list and no body
at all, while settings renders a search box plus four accordion groups.
+#### Hold a route's Suspense fallback by parking its data request
+
+**Situation:** the route skeleton is now held by data (`SWRConfig{ suspense: true }`
+at the layout), not only by the lazy module, so parking the chunk no longer keeps it
+on screen once the module is cached. The fallback lasts a few hundred ms.
+
+**Works:** park the route's own tRPC call with raw CDP `Fetch.enable` — the skeleton
+stays up until the request is released, so it can be measured and screenshotted at
+leisure. `.agents/acceptance/scripts/park-request.cjs <browser-ws> <urlPattern> <holdMs>`
+does this against an `agent-browser` session:
+
+```bash
+node .agents/acceptance/scripts/park-request.cjs \
+ "$(agent-browser --session lobehub-dev get cdp-url)" '*trpc/lambda/aiProvider*' 25000
+```
+
+Name the route's **own** query in the pattern (`aiProvider*` for the provider page).
+A broad `*trpc*` parks the shell's queries too and the route never mounts, which reads
+as a product hang. For the error state, prefer `agent-browser network route <pattern> --abort` — an aborted request settles, so the boundary renders instead of hanging.
+
+#### `SWRConfig` reaches hooks below it, never the component that renders it
+
+**Situation:** opting one page out of a subtree's suspense (a page whose sections are
+gated independently and must keep their own Retry).
+
+**Doesn't work:** wrapping that page's own JSX in `<SWRConfig value={{ suspense: false }}>`.
+The page's hooks run in its component body, which is _above_ the element it returns, so
+they still read the subtree's config and the page keeps suspending. The symptom is a
+whole route thrown to the error boundary the first time one section's fetch fails.
+
+**Works:** move the hooks into a child component and wrap that child. Verify by failing
+one section's request and confirming the rest of the page still renders.
+
#### Park a route's lazy chunk to hold its pending sidebar on screen
**Situation:** verifying what a route's `NavPanel` fallback (or any `dynamicElement`
diff --git a/.agents/acceptance/scripts/park-request.cjs b/.agents/acceptance/scripts/park-request.cjs
new file mode 100644
index 00000000000..9b40ca5b5fc
--- /dev/null
+++ b/.agents/acceptance/scripts/park-request.cjs
@@ -0,0 +1,37 @@
+// 停住匹配的请求,把 Suspense fallback 定格在屏幕上;SIGINT 时放行
+const WebSocket = require('ws');
+const [,, browserWs, pattern, holdMs] = process.argv;
+
+(async () => {
+ const http = require('node:http');
+ const port = new URL(browserWs).port;
+ const targets = await new Promise((res, rej) => {
+ http.get(`http://127.0.0.1:${port}/json/list`, (r) => {
+ let b = ''; r.on('data', (d) => (b += d)); r.on('end', () => res(JSON.parse(b)));
+ }).on('error', rej);
+ });
+ const page = targets.find((t) => t.type === 'page' && t.url.includes('localhost:3010'));
+ if (!page) { console.log(JSON.stringify({ ok: false, error: 'no page target' })); process.exit(1); }
+
+ const ws = new WebSocket(page.webSocketDebuggerUrl, { perMessageDeflate: false });
+ let id = 0;
+ const send = (method, params = {}) => ws.send(JSON.stringify({ id: ++id, method, params }));
+ const paused = [];
+
+ ws.on('open', () => {
+ send('Fetch.enable', { patterns: [{ requestStage: 'Request', urlPattern: pattern }] });
+ console.log(JSON.stringify({ ok: true, armed: pattern, target: page.url }));
+ });
+ ws.on('message', (raw) => {
+ const msg = JSON.parse(raw);
+ if (msg.method === 'Fetch.requestPaused') {
+ paused.push(msg.params.requestId);
+ console.log(JSON.stringify({ paused: msg.params.request.url.slice(0, 110) }));
+ }
+ });
+ setTimeout(() => {
+ for (const requestId of paused) send('Fetch.failRequest', { requestId, errorReason: 'Failed' });
+ send('Fetch.disable');
+ setTimeout(() => { console.log(JSON.stringify({ released: paused.length })); process.exit(0); }, 300);
+ }, Number(holdMs || 15000));
+})();
diff --git a/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts b/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts
index 3d3599a62ee..ccec0ff1145 100644
--- a/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts
+++ b/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts
@@ -33,7 +33,6 @@ import type {
McpToolResult,
} from '@lobechat/heterogeneous-agents/builtinMcp';
import { listHeterogeneousAgentModels } from '@lobechat/heterogeneous-agents/models';
-import { isLoginShellTimeoutStatus } from '@lobechat/heterogeneous-agents/resolveCliCommand';
import type { HeteroExecImageRef } from '@lobechat/heterogeneous-agents/protocol';
import {
buildHeteroExecStdinPayload,
@@ -46,6 +45,7 @@ import {
QuotaSnapshotCache,
readClaudeCodeIdentity,
} from '@lobechat/heterogeneous-agents/quota-sampler';
+import { isLoginShellTimeoutStatus } from '@lobechat/heterogeneous-agents/resolveCliCommand';
import type { AgentStreamEvent, UsageData } from '@lobechat/heterogeneous-agents/spawn';
import {
AcpRpcResponseError,
diff --git a/package.json b/package.json
index 18155431709..e870079a95b 100644
--- a/package.json
+++ b/package.json
@@ -174,6 +174,7 @@
]
},
"overrides": {
+ "@ant-design/icons": "6.3.2",
"@types/react": "19.2.13",
"antd": "6.3.5",
"baseline-browser-mapping": "2.10.31",
@@ -186,7 +187,7 @@
},
"dependencies": {
"@aiden0z/pptx-renderer": "^1.2.4",
- "@ant-design/icons": "^6.3.4",
+ "@ant-design/icons": "6.3.2",
"@anthropic-ai/sdk": "^0.73.0",
"@atlaskit/pragmatic-drag-and-drop": "^1.8.1",
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.2.0",
@@ -591,6 +592,7 @@
"workerd"
],
"overrides": {
+ "@ant-design/icons": "6.3.2",
"@react-pdf/image": "3.0.4",
"@types/react": "19.2.13",
"@vitest/coverage-v8": "3.2.6",
diff --git a/packages/builtin-tool-claude-code/src/client/Render/Edit/index.tsx b/packages/builtin-tool-claude-code/src/client/Render/Edit/index.tsx
index 7d62ac07d84..22a5a606a3e 100644
--- a/packages/builtin-tool-claude-code/src/client/Render/Edit/index.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Render/Edit/index.tsx
@@ -1,7 +1,8 @@
'use client';
import type { BuiltinRenderProps } from '@lobechat/types';
-import { CodeDiff, Flexbox, Skeleton } from '@lobehub/ui';
+import { CodeDiff, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import path from 'path-browserify-esm';
import { memo } from 'react';
@@ -13,7 +14,7 @@ interface EditArgs {
}
const Edit = memo<BuiltinRenderProps<EditArgs>>(({ args }) => {
- if (!args) return <Skeleton active />;
+ if (!args) return <Skeleton.Text rows={4} />;
const filePath = args.file_path || '';
const fileName = filePath ? path.basename(filePath) : '';
diff --git a/packages/builtin-tool-claude-code/src/client/Render/Write/index.tsx b/packages/builtin-tool-claude-code/src/client/Render/Write/index.tsx
index 5d44edb39bf..2c0933fa59a 100644
--- a/packages/builtin-tool-claude-code/src/client/Render/Write/index.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Render/Write/index.tsx
@@ -1,7 +1,8 @@
'use client';
import type { BuiltinRenderProps } from '@lobechat/types';
-import { Highlighter, Markdown, Skeleton } from '@lobehub/ui';
+import { Highlighter, Markdown } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import path from 'path-browserify-esm';
import { memo } from 'react';
@@ -11,7 +12,7 @@ interface WriteArgs {
}
const Write = memo<BuiltinRenderProps<WriteArgs>>(({ args }) => {
- if (!args) return <Skeleton active />;
+ if (!args) return <Skeleton.Text rows={4} />;
const filePath = args.file_path || '';
const ext = filePath ? path.extname(filePath).slice(1).toLowerCase() : '';
diff --git a/packages/builtin-tool-local-system/src/client/Intervention/EditLocalFile/index.tsx b/packages/builtin-tool-local-system/src/client/Intervention/EditLocalFile/index.tsx
index 6639f113ecb..6bf98cd19f6 100644
--- a/packages/builtin-tool-local-system/src/client/Intervention/EditLocalFile/index.tsx
+++ b/packages/builtin-tool-local-system/src/client/Intervention/EditLocalFile/index.tsx
@@ -1,7 +1,7 @@
import type { EditLocalFileParams } from '@lobechat/electron-client-ipc';
import type { BuiltinInterventionProps } from '@lobechat/types';
-import { CodeDiff, Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Alert, Text } from '@lobehub/ui/base-ui';
+import { CodeDiff, Flexbox, Icon } from '@lobehub/ui';
+import { Alert, Skeleton, Text } from '@lobehub/ui/base-ui';
import { ChevronRight } from 'lucide-react';
import path from 'path-browserify-esm';
import { memo, useMemo } from 'react';
@@ -62,7 +62,7 @@ const EditLocalFile = memo<BuiltinInterventionProps<EditLocalFileParams>>(({ arg
</Flexbox>
{isLoading ? (
- <Skeleton active paragraph={{ rows: 3 }} />
+ <Skeleton.Text rows={3} />
) : (
<Flexbox gap={8}>
{isAmbiguous ? (
diff --git a/packages/builtin-tool-local-system/src/client/Placeholder/ListFiles.tsx b/packages/builtin-tool-local-system/src/client/Placeholder/ListFiles.tsx
index d27af1705eb..854f865ad80 100644
--- a/packages/builtin-tool-local-system/src/client/Placeholder/ListFiles.tsx
+++ b/packages/builtin-tool-local-system/src/client/Placeholder/ListFiles.tsx
@@ -1,6 +1,7 @@
import type { ListLocalFileParams } from '@lobechat/electron-client-ipc';
import type { BuiltinPlaceholderProps } from '@lobechat/types';
-import { Center, Flexbox, Skeleton } from '@lobehub/ui';
+import { Center, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import React, { memo } from 'react';
import { LocalFolder } from '@/features/LocalFile';
@@ -11,10 +12,10 @@ export const ListFiles = memo<BuiltinPlaceholderProps<ListLocalFileParams>>(({ a
{args?.path && <LocalFolder path={args.path} />}
<Center height={140}>
<Flexbox gap={4} width={'90%'}>
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
</Flexbox>
</Center>
</Flexbox>
diff --git a/packages/builtin-tool-local-system/src/client/Placeholder/SearchFiles.tsx b/packages/builtin-tool-local-system/src/client/Placeholder/SearchFiles.tsx
index e8fffcadafc..115a752e363 100644
--- a/packages/builtin-tool-local-system/src/client/Placeholder/SearchFiles.tsx
+++ b/packages/builtin-tool-local-system/src/client/Placeholder/SearchFiles.tsx
@@ -1,6 +1,7 @@
import type { LocalSearchFilesParams } from '@lobechat/electron-client-ipc';
import type { BuiltinPlaceholderProps } from '@lobechat/types';
-import { Center, Flexbox, Icon, Skeleton } from '@lobehub/ui';
+import { Center, Flexbox, Icon } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { SearchIcon } from 'lucide-react';
import React, { memo } from 'react';
@@ -26,21 +27,17 @@ const SearchFiles = memo<BuiltinPlaceholderProps<LocalSearchFilesParams>>(({ arg
<Flexbox horizontal align={'center'} distribution={'space-between'} gap={40} height={26}>
<Flexbox horizontal align={'center'} className={styles.query} gap={8}>
<Icon icon={SearchIcon} />
- {args.keywords ? (
- args.keywords
- ) : (
- <Skeleton.Block active style={{ height: 20, width: 40 }} />
- )}
+ {args.keywords ? args.keywords : <Skeleton height={20} width={40} />}
</Flexbox>
- <Skeleton.Block active style={{ height: 20, width: 40 }} />
+ <Skeleton height={20} width={40} />
</Flexbox>
<Center height={140}>
<Flexbox gap={4} width={'90%'}>
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
</Flexbox>
</Center>
</Flexbox>
diff --git a/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx b/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx
index 38f85d4d763..e333c9d8e04 100644
--- a/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx
+++ b/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx
@@ -1,12 +1,12 @@
import type { EditLocalFileState } from '@lobechat/builtin-tool-local-system';
import type { BuiltinRenderProps } from '@lobechat/types';
-import { Flexbox, PatchDiff, Skeleton } from '@lobehub/ui';
-import { Alert } from '@lobehub/ui/base-ui';
+import { Flexbox, PatchDiff } from '@lobehub/ui';
+import { Alert, Skeleton } from '@lobehub/ui/base-ui';
import React, { memo } from 'react';
const EditLocalFile = memo<BuiltinRenderProps<any, EditLocalFileState>>(
({ args, pluginState, pluginError }) => {
- if (!args) return <Skeleton active />;
+ if (!args) return <Skeleton.Text rows={4} />;
// Support both IPC format (file_path) and ComputerRuntime format (path)
const filePath = args.file_path || args.path || '';
diff --git a/packages/builtin-tool-local-system/src/client/Render/ListFiles/Result.tsx b/packages/builtin-tool-local-system/src/client/Render/ListFiles/Result.tsx
index 0f21817983c..ed6bae1e91f 100644
--- a/packages/builtin-tool-local-system/src/client/Render/ListFiles/Result.tsx
+++ b/packages/builtin-tool-local-system/src/client/Render/ListFiles/Result.tsx
@@ -1,6 +1,7 @@
import { useToolRenderCapabilities } from '@lobechat/shared-tool-ui';
import type { ChatMessagePluginError } from '@lobechat/types';
-import { Block, Empty, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Empty, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { FolderOpenIcon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -21,10 +22,10 @@ const SearchFiles = memo<SearchFilesProps>(({ listResults = [], messageId }) =>
if (loading) {
return (
<Flexbox gap={4}>
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
</Flexbox>
);
}
diff --git a/packages/builtin-tool-local-system/src/client/Render/ReadLocalFile/ReadFileSkeleton.tsx b/packages/builtin-tool-local-system/src/client/Render/ReadLocalFile/ReadFileSkeleton.tsx
index 11cd916bc7c..64c5ac5a13f 100644
--- a/packages/builtin-tool-local-system/src/client/Render/ReadLocalFile/ReadFileSkeleton.tsx
+++ b/packages/builtin-tool-local-system/src/client/Render/ReadLocalFile/ReadFileSkeleton.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import React, { memo } from 'react';
@@ -19,17 +20,16 @@ const ReadFileSkeleton = memo(() => {
<Flexbox className={styles.container} gap={2}>
<Flexbox horizontal align={'center'} gap={24} justify={'space-between'}>
<Flexbox horizontal align={'center'} flex={1} gap={8} style={{ overflow: 'hidden' }}>
- <Skeleton.Block active style={{ flex: 1, height: 16, width: 20 }} />
+ <Skeleton height={16} style={{ flex: 1 }} width={20} />
- <Skeleton.Block active style={{ flex: 1, height: 16, minWidth: 100 }} />
+ <Skeleton height={16} style={{ flex: 1, minWidth: 100 }} />
</Flexbox>
<Flexbox align={'center'} className={styles.meta} gap={16}>
- <Skeleton.Block active style={{ height: 16, maxWidth: 40 }} />
+ <Skeleton height={16} style={{ maxWidth: 40 }} />
</Flexbox>
</Flexbox>
- {/* Path */}
- <Skeleton.Block active style={{ height: 16, width: '100%' }} />
+ <Skeleton height={16} />
</Flexbox>
);
});
diff --git a/packages/builtin-tool-local-system/src/client/Render/SearchFiles/Result.tsx b/packages/builtin-tool-local-system/src/client/Render/SearchFiles/Result.tsx
index 7101287ad78..6ea9201060e 100644
--- a/packages/builtin-tool-local-system/src/client/Render/SearchFiles/Result.tsx
+++ b/packages/builtin-tool-local-system/src/client/Render/SearchFiles/Result.tsx
@@ -1,6 +1,7 @@
import { useToolRenderCapabilities } from '@lobechat/shared-tool-ui';
import type { ChatMessagePluginError } from '@lobechat/types';
-import { Block, Empty, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Empty, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { SearchIcon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -21,10 +22,10 @@ const SearchFiles = memo<SearchFilesProps>(({ searchResults = [], messageId }) =
if (loading) {
return (
<Flexbox gap={4}>
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
- <Skeleton.Button active block style={{ height: 16 }} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
+ <Skeleton height={16} />
</Flexbox>
);
}
diff --git a/packages/builtin-tool-local-system/src/client/Render/WriteFile/index.tsx b/packages/builtin-tool-local-system/src/client/Render/WriteFile/index.tsx
index cb554c73a1a..9cdd3baaa44 100644
--- a/packages/builtin-tool-local-system/src/client/Render/WriteFile/index.tsx
+++ b/packages/builtin-tool-local-system/src/client/Render/WriteFile/index.tsx
@@ -1,6 +1,7 @@
import type { WriteLocalFileParams } from '@lobechat/electron-client-ipc';
import type { BuiltinRenderProps } from '@lobechat/types';
-import { Flexbox, Icon, Markdown, PatchDiff, Skeleton } from '@lobehub/ui';
+import { Flexbox, Icon, Markdown, PatchDiff } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { ChevronRight } from 'lucide-react';
import path from 'path-browserify-esm';
@@ -38,7 +39,7 @@ type WriteFileArgs = WriteLocalFileParams & {
};
const WriteFile = memo<BuiltinRenderProps<WriteFileArgs>>(({ args }) => {
- if (!args) return <Skeleton active />;
+ if (!args) return <Skeleton.Text rows={4} />;
const filePath = args.path || args.filePath || args.file_path || '';
const { base, dir } = path.parse(filePath);
diff --git a/packages/builtin-tool-web-browsing/src/client/Placeholder/Search.tsx b/packages/builtin-tool-web-browsing/src/client/Placeholder/Search.tsx
index 19986d9aabf..2e903c895fb 100644
--- a/packages/builtin-tool-web-browsing/src/client/Placeholder/Search.tsx
+++ b/packages/builtin-tool-web-browsing/src/client/Placeholder/Search.tsx
@@ -1,5 +1,6 @@
import type { BuiltinPlaceholderProps, SearchQuery } from '@lobechat/types';
-import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { SearchIcon } from 'lucide-react';
import { memo } from 'react';
@@ -43,18 +44,14 @@ export const Search = memo<BuiltinPlaceholderProps<SearchQuery>>(({ args }) => {
>
<Flexbox horizontal align={'center'} className={styles.query} gap={8}>
<Icon icon={SearchIcon} />
- {query ? query : <Skeleton.Block active style={{ height: 20, width: 40 }} />}
+ {query ? query : <Skeleton height={20} width={40} />}
</Flexbox>
- <Skeleton.Block active style={{ height: 20, width: 40 }} />
+ <Skeleton height={20} width={40} />
</Flexbox>
<Flexbox horizontal gap={12}>
{['1', '2', '3', '4', '5'].map((id) => (
- <Skeleton.Button
- active
- key={id}
- style={{ borderRadius: 8, height: ITEM_HEIGHT, width: ITEM_WIDTH }}
- />
+ <Skeleton height={ITEM_HEIGHT} key={id} radius={8} width={ITEM_WIDTH} />
))}
</Flexbox>
</Flexbox>
diff --git a/packages/builtin-tool-web-browsing/src/client/Portal/Search/index.tsx b/packages/builtin-tool-web-browsing/src/client/Portal/Search/index.tsx
index 0907a7af97d..422c2361c52 100644
--- a/packages/builtin-tool-web-browsing/src/client/Portal/Search/index.tsx
+++ b/packages/builtin-tool-web-browsing/src/client/Portal/Search/index.tsx
@@ -1,5 +1,6 @@
import type { SearchQuery, UniformSearchResponse } from '@lobechat/types';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { uniq } from 'es-toolkit/compat';
import { memo } from 'react';
@@ -33,12 +34,7 @@ const Inspector = memo<InspectorUIProps>(({ query: args, messageId, response })
<Flexbox gap={16} paddingBlock={16} paddingInline={12}>
{[1, 2, 3, 4, 6].map((id) => (
- <Skeleton
- active
- key={id}
- paragraph={{ rows: 3, width: `${(id % 4) + 5}0%` }}
- title={false}
- />
+ <Skeleton.Text key={id} rows={3} width={`${(id % 4) + 5}0%`} />
))}
</Flexbox>
</Flexbox>
diff --git a/packages/builtin-tool-web-browsing/src/client/Render/PageContent/Loading.tsx b/packages/builtin-tool-web-browsing/src/client/Render/PageContent/Loading.tsx
index aae64b7290a..9173c42ee7a 100644
--- a/packages/builtin-tool-web-browsing/src/client/Render/PageContent/Loading.tsx
+++ b/packages/builtin-tool-web-browsing/src/client/Render/PageContent/Loading.tsx
@@ -1,6 +1,7 @@
'use client';
-import { CopyButton, Flexbox, Skeleton } from '@lobehub/ui';
+import { CopyButton, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -49,8 +50,8 @@ const LoadingCard = memo<{ url: string }>(({ url }) => {
<CopyButton content={url} size={'small'} />
</Flexbox>
<Flexbox gap={4} paddingInline={16}>
- <Skeleton.Block active style={{ height: 14, width: '95%' }} />
- <Skeleton.Block active style={{ height: 14, width: '40%' }} />
+ <Skeleton height={14} width={'95%'} />
+ <Skeleton height={14} width={'40%'} />
</Flexbox>
<div className={styles.footer}>{t('search.crawPages.crawling')}</div>
diff --git a/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchQuery/SearchView.tsx b/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchQuery/SearchView.tsx
index d47e40deda2..de1d943d156 100644
--- a/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchQuery/SearchView.tsx
+++ b/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchQuery/SearchView.tsx
@@ -1,5 +1,5 @@
-import { Block, Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Block, Flexbox, Icon } from '@lobehub/ui';
+import { Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { SearchIcon } from 'lucide-react';
import { memo } from 'react';
@@ -53,7 +53,7 @@ const SearchBar = memo<SearchBarProps>(
</Block>
{searching ? (
- <Skeleton.Block active style={{ height: 20, width: 40 }} />
+ <Skeleton height={20} width={40} />
) : (
<Flexbox horizontal align={'center'} gap={4}>
<EngineAvatarGroup engines={defaultEngines} />
diff --git a/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchResult/index.tsx b/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchResult/index.tsx
index 9b146da6bdd..64f003900c8 100644
--- a/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchResult/index.tsx
+++ b/packages/builtin-tool-web-browsing/src/client/Render/Search/SearchResult/index.tsx
@@ -1,5 +1,6 @@
import type { SearchQuery, UniformSearchResponse } from '@lobechat/types';
-import { Block, Button, Empty, Flexbox, Icon, ScrollShadow, Skeleton } from '@lobehub/ui';
+import { Block, Empty, Flexbox, Icon, ScrollShadow } from '@lobehub/ui';
+import { Button, Skeleton } from '@lobehub/ui/base-ui';
import { uniq } from 'es-toolkit/compat';
import { Edit2Icon, SearchIcon } from 'lucide-react';
import { memo } from 'react';
@@ -37,7 +38,7 @@ const SearchResult = memo<SearchResultProps>(
return (
<Flexbox horizontal gap={8}>
{['1', '2', '3', '4', '5'].map((id) => (
- <Skeleton.Block active height={ITEM_HEIGHT} key={id} width={ITEM_WIDTH} />
+ <Skeleton height={ITEM_HEIGHT} key={id} width={ITEM_WIDTH} />
))}
</Flexbox>
);
@@ -48,10 +49,9 @@ const SearchResult = memo<SearchResultProps>(
<Empty description={t('search.emptyResult')} icon={SearchIcon}>
{!editing && (
<Button
- color={'default'}
icon={<Icon icon={Edit2Icon} />}
size={'small'}
- variant={'filled'}
+ type={'fill'}
onClick={() => {
setEditing(true);
}}
diff --git a/src/components/CommentList/index.tsx b/src/components/CommentList/index.tsx
index 8b1d0338d9f..e48560baaec 100644
--- a/src/components/CommentList/index.tsx
+++ b/src/components/CommentList/index.tsx
@@ -1,11 +1,12 @@
'use client';
-import { Empty, Flexbox, Skeleton } from '@lobehub/ui';
+import { Empty, Flexbox } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { MessageSquare } from 'lucide-react';
import { memo, useCallback, useState, useTransition } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { type SkillCommentItem, type SkillCommentListResponse } from '@/types/discover';
import CommentItem from './CommentItem';
@@ -58,7 +59,7 @@ const CommentList = memo<CommentListProps>(({ initialData, fetchMore }) => {
{isPending && items.length === 0 ? (
<Flexbox gap={24}>
{Array.from({ length: 3 }).map((_, i) => (
- <Skeleton active key={i} paragraph={{ rows: 2 }} title={{ width: 120 }} />
+ <ArticleSkeleton key={i} rows={2} title={120} />
))}
</Flexbox>
) : (
diff --git a/src/components/ListSkeleton/index.tsx b/src/components/ListSkeleton/index.tsx
index 6863b717c45..72b11b85c6b 100644
--- a/src/components/ListSkeleton/index.tsx
+++ b/src/components/ListSkeleton/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
interface ListSkeletonProps {
@@ -27,10 +28,10 @@ const ListSkeleton = memo<ListSkeletonProps>(({ paddingInline = 12, rows = 4 })
key={index}
style={{ paddingBlock: 12, paddingInline }}
>
- <Skeleton.Avatar active shape={'square'} size={48} />
+ <Skeleton.Avatar shape={'square'} size={48} />
<Flexbox flex={1} gap={8}>
- <Skeleton.Button active size={'small'} style={{ height: 14, width: 140 }} />
- <Skeleton.Button active size={'small'} style={{ height: 12, width: 200 }} />
+ <Skeleton height={14} width={140} />
+ <Skeleton height={12} width={200} />
</Flexbox>
</Flexbox>
))}
diff --git a/src/components/LiteTable/index.tsx b/src/components/LiteTable/index.tsx
index f470572e2b8..26a6aefb326 100644
--- a/src/components/LiteTable/index.tsx
+++ b/src/components/LiteTable/index.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { type ReactNode } from 'react';
import { memo } from 'react';
@@ -207,11 +207,7 @@ const LiteTableInner = <RecordType,>({
data-list-slot={column.listSlot}
key={column.key}
>
- <Skeleton.Button
- active
- size={'small'}
- style={{ height: 14, minWidth: 0, width: '100%' }}
- />
+ <Skeleton style={{ height: 14, minWidth: 0, width: '100%' }} />
</td>
))}
</tr>
diff --git a/src/components/Loading/SkeletonLoading/index.tsx b/src/components/Loading/SkeletonLoading/index.tsx
index 87fb0d3153c..c0c262318b7 100644
--- a/src/components/Loading/SkeletonLoading/index.tsx
+++ b/src/components/Loading/SkeletonLoading/index.tsx
@@ -1,10 +1,10 @@
'use client';
-import { Skeleton } from '@lobehub/ui';
-import { type SkeletonProps } from 'antd';
import { createStaticStyles, cx, responsive } from 'antd-style';
import { memo } from 'react';
+import { ArticleSkeleton } from '@/components/Skeleton';
+
const styles = createStaticStyles(
({ css }) => css`
${responsive.sm} {
@@ -13,19 +13,8 @@ const styles = createStaticStyles(
`,
);
-const SkeletonLoading = memo<SkeletonProps>(
- ({ className, classNames, styles: customStyles, ...rest }) => {
- return (
- <Skeleton
- active
- className={cx(styles, className)}
- classNames={classNames as any}
- paragraph={{ rows: 8 }}
- styles={customStyles as any}
- {...rest}
- />
- );
- },
-);
+const SkeletonLoading = memo<{ className?: string }>(({ className }) => (
+ <ArticleSkeleton className={cx(styles, className)} rows={8} />
+));
export default SkeletonLoading;
diff --git a/src/components/ModelSelect/index.tsx b/src/components/ModelSelect/index.tsx
index 0beb5a15b6c..395f1849c9d 100644
--- a/src/components/ModelSelect/index.tsx
+++ b/src/components/ModelSelect/index.tsx
@@ -247,7 +247,7 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
},
);
-interface ModelItemRenderProps extends ChatModelCard, Partial<Omit<FlexboxProps, 'id' | 'title'>> {
+interface ModelItemRenderProps extends ChatModelCard, Pick<FlexboxProps, 'className' | 'style'> {
abilities?: ModelAbilities;
audio?: boolean;
newBadgeLabel?: string;
@@ -271,7 +271,8 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
id,
displayName,
releasedAt,
- ...rest
+ className,
+ style,
}) => {
const { mobile } = useResponsive();
const displayNameOrId = displayName || id;
@@ -280,14 +281,14 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
<Flexbox
horizontal
align={'center'}
+ className={className}
gap={32}
justify={'space-between'}
- {...rest}
style={{
overflow: 'hidden',
position: 'relative',
width: '100%',
- ...rest.style,
+ ...style,
}}
>
<Flexbox
diff --git a/src/components/Skeleton/Article.tsx b/src/components/Skeleton/Article.tsx
new file mode 100644
index 00000000000..cfeef37ed4e
--- /dev/null
+++ b/src/components/Skeleton/Article.tsx
@@ -0,0 +1,49 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
+import { type CSSProperties, memo } from 'react';
+
+interface ArticleSkeletonProps {
+ avatar?: boolean | number;
+ className?: string;
+ rows?: number;
+ style?: CSSProperties;
+ title?: boolean | number | string;
+}
+
+const ArticleSkeleton = memo<ArticleSkeletonProps>(
+ ({ avatar = false, className, rows = 3, style, title = true }) => {
+ const body = (
+ <Flexbox gap={16} width={'100%'}>
+ {title !== false && <Skeleton.Text width={title === true ? '60%' : title} />}
+ {rows > 0 && <Skeleton.Text rows={rows} />}
+ </Flexbox>
+ );
+
+ if (!avatar)
+ return (
+ <Flexbox className={className} style={style} width={'100%'}>
+ {body}
+ </Flexbox>
+ );
+
+ return (
+ <Flexbox
+ horizontal
+ align={'flex-start'}
+ className={className}
+ gap={16}
+ style={style}
+ width={'100%'}
+ >
+ <Skeleton.Avatar size={avatar === true ? 40 : avatar} />
+ {body}
+ </Flexbox>
+ );
+ },
+);
+
+ArticleSkeleton.displayName = 'ArticleSkeleton';
+
+export default ArticleSkeleton;
diff --git a/src/components/Skeleton/Bar.tsx b/src/components/Skeleton/Bar.tsx
index 104f0eae7d6..44b1534fb72 100644
--- a/src/components/Skeleton/Bar.tsx
+++ b/src/components/Skeleton/Bar.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
export interface SkeletonBarProps {
@@ -10,10 +10,8 @@ export interface SkeletonBarProps {
}
const SkeletonBar = ({ height, width = '100%', radius }: SkeletonBarProps) => (
- <Skeleton.Button
- active
- block
- size={'small'}
+ <Skeleton
+ height={28}
style={{
borderRadius: radius ?? cssVar.borderRadius,
height,
diff --git a/src/components/Skeleton/CommunityList.tsx b/src/components/Skeleton/CommunityList.tsx
new file mode 100644
index 00000000000..cf354f75688
--- /dev/null
+++ b/src/components/Skeleton/CommunityList.tsx
@@ -0,0 +1,79 @@
+'use client';
+
+import { Block, Flexbox, Grid } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
+import { createStaticStyles } from 'antd-style';
+import { memo } from 'react';
+
+import type { RouteSkeletonProps } from '@/spa/router/routeMeta';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ footer: css`
+ border-block-start: 1px dashed ${cssVar.colorBorder};
+ background: ${cssVar.colorBgContainer};
+ `,
+ toolbar: css`
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+ `,
+}));
+
+export interface CommunityListSkeletonProps extends RouteSkeletonProps {
+ length?: number;
+ rows?: number;
+}
+
+/**
+ * Shared by the route fallback and the page's own loading state, so the cards
+ * keep their geometry when one hands over to the other. `chrome="body"` drops
+ * the toolbar the list layout draws once it has mounted.
+ */
+const CommunityListSkeleton = memo<CommunityListSkeletonProps>(
+ ({ rows = 3, length = 12, chrome = 'page' }) => (
+ <Flexbox gap={16} width={'100%'}>
+ {chrome !== 'body' && (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.toolbar}
+ gap={12}
+ height={56}
+ justify={'space-between'}
+ paddingInline={16}
+ >
+ <Skeleton height={20} width={280} />
+ <Skeleton height={28} width={132} />
+ </Flexbox>
+ )}
+ <Grid rows={rows} width={'100%'}>
+ {Array.from({ length }).map((_, index) => (
+ <Block gap={12} key={index} padding={16} variant={'outlined'}>
+ <Flexbox horizontal align={'center'} gap={12}>
+ <Skeleton.Avatar shape="square" size={40} style={{ flex: 'none' }} />
+ <Flexbox flex={1} gap={4}>
+ <Skeleton height={20} width={'70%'} />
+ <Skeleton height={14} width={'40%'} />
+ </Flexbox>
+ </Flexbox>
+ <Skeleton.Text rows={3} style={{ marginBottom: 0 }} />
+ <Flexbox horizontal gap={8}>
+ <Skeleton height={20} width={60} />
+ <Skeleton height={20} width={50} />
+ </Flexbox>
+ <Flexbox
+ className={styles.footer}
+ gap={4}
+ padding={8}
+ style={{ marginBottom: -16, marginInline: -16 }}
+ >
+ <Skeleton height={14} width={100} />
+ </Flexbox>
+ </Block>
+ ))}
+ </Grid>
+ </Flexbox>
+ ),
+);
+
+CommunityListSkeleton.displayName = 'CommunityListSkeleton';
+
+export default CommunityListSkeleton;
diff --git a/src/components/Skeleton/Conversation/List.tsx b/src/components/Skeleton/Conversation/List.tsx
index b600e693b64..19e0532a1d2 100644
--- a/src/components/Skeleton/Conversation/List.tsx
+++ b/src/components/Skeleton/Conversation/List.tsx
@@ -1,6 +1,9 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
+
+import { ArticleSkeleton } from '@/components/Skeleton';
import ConversationSkeletonContainer from './Container';
@@ -13,13 +16,16 @@ const ConversationListSkeleton = () => (
style={{ marginTop: 24 }}
>
<Flexbox gap={8} style={{ paddingLeft: '25%' }} width={'100%'}>
- <Skeleton.Paragraph active rows={3} style={{ alignItems: 'flex-end' }} />
+ <Skeleton.Text rows={3} style={{ alignItems: 'flex-end' }} />
</Flexbox>
{Array.from({ length: 2 }).map((_, index) => (
<Flexbox gap={8} key={index} width={'100%'}>
- <Skeleton active avatar={{ shape: 'square', size: 28 }} paragraph={false} />
- <Skeleton.Paragraph />
- <Skeleton.Tags count={2} />
+ <ArticleSkeleton avatar={28} rows={0} />
+ <Skeleton.Text />
+ <Flexbox horizontal gap={8}>
+ <Skeleton height={22} radius={4} width={48} />
+ <Skeleton height={22} radius={4} width={48} />
+ </Flexbox>
</Flexbox>
))}
</ConversationSkeletonContainer>
diff --git a/src/components/Skeleton/Generation.tsx b/src/components/Skeleton/Generation.tsx
index 42d0e7324c4..a14c24d7148 100644
--- a/src/components/Skeleton/Generation.tsx
+++ b/src/components/Skeleton/Generation.tsx
@@ -1,47 +1,78 @@
'use client';
import { Flexbox, Grid } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
+import { cssVar } from 'antd-style';
+import { useLocation } from 'react-router';
+
+import type { RouteSkeletonProps } from '@/spa/router/routeMeta';
import SkeletonBar from './Bar';
+import SkeletonContainer from './Conversation/Container';
+
+const HeaderSkeleton = () => (
+ <Flexbox
+ horizontal
+ align={'center'}
+ flex={'none'}
+ height={44}
+ justify={'space-between'}
+ paddingInline={16}
+ >
+ <SkeletonBar height={20} width={120} />
+ <SkeletonBar height={28} width={28} />
+ </Flexbox>
+);
-const styles = createStaticStyles(({ css }) => ({
- panel: css`
- flex-shrink: 0;
- width: 280px;
- border-inline-end: 1px solid ${cssVar.colorBorderSecondary};
-
- @media (width <= 900px) {
- display: none;
- }
- `,
- prompt: css`
- height: 96px;
- border: 1px solid ${cssVar.colorFill};
- border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorBgElevated};
- `,
-}));
-
-const GenerationSkeleton = () => (
- <Flexbox aria-busy horizontal flex={1} height={'100%'} style={{ overflow: 'hidden' }}>
- <Flexbox className={styles.panel} gap={20} padding={16}>
+/**
+ * No `?topic=`: `CreateGenerationPage` renders a single prompt input centered in
+ * the viewport, with the title above it — no feed, and no panel of its own. The
+ * generation sidebar is portal'd into the app shell's nav panel, so a fallback
+ * that draws one inside the content area invents chrome the page never had.
+ */
+const HomeSkeleton = () => (
+ <SkeletonContainer
+ align={'center'}
+ justify={'center'}
+ style={{ minHeight: 'calc(100vh - 180px)' }}
+ >
+ <SkeletonBar height={32} width={280} />
+ <div style={{ height: 24 }} />
+ <SkeletonBar height={148} radius={cssVar.borderRadiusLG} />
+ </SkeletonContainer>
+);
+
+/** With a topic: the batch feed above, the prompt input pinned below. */
+const TopicSkeleton = () => (
+ <SkeletonContainer flex={1} gap={16} paddingBlock={16}>
+ <SkeletonBar height={20} width={'95%'} />
+ <Flexbox horizontal gap={12}>
+ <SkeletonBar height={16} width={120} />
+ <SkeletonBar height={16} width={80} />
+ <SkeletonBar height={16} width={60} />
+ <SkeletonBar height={16} width={70} />
+ </Flexbox>
+ <Grid maxItemWidth={200} rows={4} width={'100%'}>
{Array.from({ length: 4 }).map((_, index) => (
- <Flexbox gap={8} key={index}>
- <SkeletonBar height={12} width={72 + (index % 2) * 32} />
- <SkeletonBar height={32} radius={cssVar.borderRadius} />
- </Flexbox>
+ <SkeletonBar height={200} key={index} radius={cssVar.borderRadiusLG} />
))}
- </Flexbox>
- <Flexbox flex={1} justify={'space-between'} padding={16} style={{ minWidth: 0 }}>
- <Grid gap={12} maxItemWidth={200} rows={2} width={'100%'}>
- {Array.from({ length: 4 }).map((_, index) => (
- <SkeletonBar height={200} key={index} radius={cssVar.borderRadiusLG} />
- ))}
- </Grid>
- <div className={styles.prompt} />
- </Flexbox>
- </Flexbox>
+ </Grid>
+ <div style={{ flex: 1 }} />
+ <SkeletonBar height={148} radius={cssVar.borderRadiusLG} />
+ </SkeletonContainer>
);
+const GenerationSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => {
+ const { search } = useLocation();
+ const isHome = !new URLSearchParams(search).get('topic');
+
+ return (
+ <Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
+ {chrome !== 'body' && <HeaderSkeleton />}
+ <Flexbox flex={1} style={{ minHeight: 0, overflow: 'hidden' }}>
+ {isHome ? <HomeSkeleton /> : <TopicSkeleton />}
+ </Flexbox>
+ </Flexbox>
+ );
+};
+
export default GenerationSkeleton;
diff --git a/src/components/Skeleton/RouteSegment.tsx b/src/components/Skeleton/RouteSegment.tsx
index df277ea125f..97fd2b9181f 100644
--- a/src/components/Skeleton/RouteSegment.tsx
+++ b/src/components/Skeleton/RouteSegment.tsx
@@ -2,6 +2,7 @@
import { useLocation } from 'react-router';
+import { useRouteSkeletonChrome } from '@/spa/router/routeSkeletonChrome';
import { useRouteSkeleton } from '@/spa/router/useRouteSkeleton';
import AppsSkeleton from './Apps';
@@ -37,17 +38,18 @@ const isConversationPath = (pathname: string) => {
const RouteSegmentSkeleton = () => {
const Skeleton = useRouteSkeleton();
+ const chrome = useRouteSkeletonChrome();
const { pathname } = useLocation();
const segments = pathname.split('/').filter(Boolean);
- if (Skeleton) return <Skeleton />;
+ if (Skeleton) return <Skeleton chrome={chrome} />;
// `settings` at any depth: workspace settings live at /:slug/settings/*
- if (segments.includes('settings')) return <SettingsPageSkeleton />;
+ if (segments.includes('settings')) return <SettingsPageSkeleton chrome={chrome} />;
if (segments[0] === 'apps') return <AppsSkeleton />;
if (isConversationPath(pathname)) return <ConversationLayoutSkeleton />;
- if (segments[0] === 'memory' && segments.length === 1) return <MemorySkeleton />;
+ if (segments[0] === 'memory' && segments.length === 1) return <MemorySkeleton chrome={chrome} />;
- return <SurfaceSkeleton variant={getSurfaceVariant(pathname)} />;
+ return <SurfaceSkeleton header={chrome !== 'body'} variant={getSurfaceVariant(pathname)} />;
};
export default RouteSegmentSkeleton;
diff --git a/src/components/Skeleton/Settings/Page.tsx b/src/components/Skeleton/Settings/Page.tsx
index f8fa846d603..176a8db08a3 100644
--- a/src/components/Skeleton/Settings/Page.tsx
+++ b/src/components/Skeleton/Settings/Page.tsx
@@ -5,21 +5,24 @@ import { useLocation } from 'react-router';
import NavHeader from '@/features/NavHeader';
import SettingContainer from '@/features/Setting/SettingContainer';
+import type { RouteSkeletonProps } from '@/spa/router/routeMeta';
import SkeletonBar from '../Bar';
import SettingsProfileSkeleton from './Profile';
import SettingsSectionSkeleton from './Section';
-const SettingsPageSkeleton = () => {
+const SettingsPageSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => {
const { pathname } = useLocation();
const tab = pathname.match(/\/settings\/([^/]+)/)?.[1] ?? 'profile';
const profile = tab === 'profile';
return (
<Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
- <NavHeader styles={{ center: { alignItems: 'center' } }}>
- <SkeletonBar height={16} width={profile ? 52 : 88} />
- </NavHeader>
+ {chrome !== 'body' && (
+ <NavHeader styles={{ center: { alignItems: 'center' } }}>
+ <SkeletonBar height={16} width={profile ? 52 : 88} />
+ </NavHeader>
+ )}
<SettingContainer maxWidth={1024} paddingBlock={'24px 128px'} paddingInline={24}>
{profile ? <SettingsProfileSkeleton /> : <SettingsSectionSkeleton />}
</SettingContainer>
diff --git a/src/components/Skeleton/SkeletonInput.tsx b/src/components/Skeleton/SkeletonInput.tsx
index a726278a0a9..1b44c370517 100644
--- a/src/components/Skeleton/SkeletonInput.tsx
+++ b/src/components/Skeleton/SkeletonInput.tsx
@@ -1,5 +1,5 @@
'use client';
-import { Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
-export const SkeletonInput = () => <Skeleton.Button active block />;
+export const SkeletonInput = () => <Skeleton height={36} />;
diff --git a/src/components/Skeleton/SkeletonSwitch.tsx b/src/components/Skeleton/SkeletonSwitch.tsx
index c9211505958..ffe133fbefb 100644
--- a/src/components/Skeleton/SkeletonSwitch.tsx
+++ b/src/components/Skeleton/SkeletonSwitch.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { css, cx } from 'antd-style';
const switchLoading = cx(css`
@@ -9,5 +9,5 @@ const switchLoading = cx(css`
`);
export const SkeletonSwitch = () => {
- return <Skeleton.Button active className={switchLoading} />;
+ return <Skeleton className={switchLoading} height={36} />;
};
diff --git a/src/components/Skeleton/Surface.tsx b/src/components/Skeleton/Surface.tsx
index 4e7fdee3c80..1f7968b28e6 100644
--- a/src/components/Skeleton/Surface.tsx
+++ b/src/components/Skeleton/Surface.tsx
@@ -2,7 +2,9 @@
import { Flexbox, FormGroup, Grid } from '@lobehub/ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import type { ReactElement } from 'react';
+import type { ComponentType } from 'react';
+
+import type { RouteSkeletonProps } from '@/spa/router/routeMeta';
import SkeletonBar from './Bar';
@@ -163,14 +165,16 @@ const SurfaceSkeleton = ({ header = true, variant = 'list' }: SurfaceSkeletonPro
</Flexbox>
);
-const surfaceSkeletonCache = new Map<string, () => ReactElement>();
+const surfaceSkeletonCache = new Map<string, ComponentType<RouteSkeletonProps>>();
export const createSurfaceSkeleton = (variant: SurfaceSkeletonVariant, header = true) => {
const key = `${variant}:${header}`;
const cached = surfaceSkeletonCache.get(key);
if (cached) return cached;
- const Component = () => <SurfaceSkeleton header={header} variant={variant} />;
+ const Component = ({ chrome = 'page' }: RouteSkeletonProps) => (
+ <SurfaceSkeleton header={header && chrome !== 'body'} variant={variant} />
+ );
Component.displayName = `SurfaceSkeleton(${key})`;
surfaceSkeletonCache.set(key, Component);
return Component;
diff --git a/src/components/Skeleton/index.ts b/src/components/Skeleton/index.ts
index 13620f7f425..78a5cfc34ea 100644
--- a/src/components/Skeleton/index.ts
+++ b/src/components/Skeleton/index.ts
@@ -1,5 +1,7 @@
export { default as AppsSkeleton } from './Apps';
+export { default as ArticleSkeleton } from './Article';
export { default as SkeletonBar } from './Bar';
+export { default as CommunityListSkeleton, type CommunityListSkeletonProps } from './CommunityList';
export { default as ConversationLayoutSkeleton } from './Conversation/Layout';
export { default as ConversationListSkeleton } from './Conversation/List';
export { default as ConversationSegmentSkeleton } from './Conversation/Segment';
diff --git a/src/components/SuspenseRouteBoundary/index.tsx b/src/components/SuspenseRouteBoundary/index.tsx
new file mode 100644
index 00000000000..bd0a21fea0b
--- /dev/null
+++ b/src/components/SuspenseRouteBoundary/index.tsx
@@ -0,0 +1,91 @@
+'use client';
+
+import { Component, type ErrorInfo, type ReactNode } from 'react';
+import { useLocation } from 'react-router';
+import { SWRConfig } from 'swr';
+
+import AsyncError, { type AsyncErrorVariant } from '@/components/AsyncError';
+
+import {
+ resetOnLocationChange,
+ type RouteBoundaryState,
+ routeResetKey,
+} from './resetOnLocationChange';
+import { useRouteRetry } from './useRouteRetry';
+
+interface BoundaryProps {
+ children: ReactNode;
+ onReset: () => void;
+ resetKey: string;
+ variant: AsyncErrorVariant;
+}
+
+class Boundary extends Component<BoundaryProps, RouteBoundaryState> {
+ state: RouteBoundaryState = { resetKey: this.props.resetKey };
+
+ static getDerivedStateFromError(error: Error) {
+ return { error };
+ }
+
+ static getDerivedStateFromProps(props: BoundaryProps, state: RouteBoundaryState) {
+ return resetOnLocationChange(props.resetKey, state);
+ }
+
+ componentDidCatch(error: Error, info: ErrorInfo) {
+ console.error('[SuspenseRouteBoundary]', error, info.componentStack);
+ }
+
+ retry = () => {
+ this.setState({ error: undefined });
+ this.props.onReset();
+ };
+
+ render() {
+ const { error } = this.state;
+ if (!error) return this.props.children;
+
+ return <AsyncError error={error} variant={this.props.variant} onRetry={this.retry} />;
+ }
+}
+
+/**
+ * Pairs with the route skeleton: loading is the route's Suspense fallback,
+ * failure is this boundary's Retry.
+ *
+ * Under `suspense`, SWR reports a failed fetch by throwing, so the four-state
+ * gate `AsyncBoundary` used to run at the call site has to move above the
+ * suspending component. Without it one failed request takes the whole route to
+ * the router's error page and the user loses the Retry that used to sit inside
+ * the surface.
+ *
+ * Two things the class boundary alone gets wrong, both because it is mounted in
+ * a *persistent* area layout that outlives the route under it:
+ *
+ * - Its error state survives navigation, so a failure on one route keeps
+ * covering the healthy sibling the user moves to. `resetKey` clears it as the
+ * location changes.
+ * - Reset has to clear the SWR entry that threw, but the error carries no key,
+ * so the naive fix is to invalidate the whole cache — which refetches every
+ * mounted consumer in the app for one route's Retry. `onError` records the
+ * keys that actually failed and reset revalidates only those.
+ */
+const SuspenseRouteBoundary = ({
+ children,
+ variant = 'page',
+}: {
+ children: ReactNode;
+ variant?: AsyncErrorVariant;
+}) => {
+ const { onError, onReset } = useRouteRetry();
+ const { pathname, search } = useLocation();
+
+ return (
+ <SWRConfig value={{ onError }}>
+ <Boundary resetKey={routeResetKey(pathname, search)} variant={variant} onReset={onReset}>
+ {children}
+ </Boundary>
+ </SWRConfig>
+ );
+};
+
+export default SuspenseRouteBoundary;
diff --git a/src/components/SuspenseRouteBoundary/resetOnLocationChange.test.ts b/src/components/SuspenseRouteBoundary/resetOnLocationChange.test.ts
new file mode 100644
index 00000000000..e4f599ff1ab
--- /dev/null
+++ b/src/components/SuspenseRouteBoundary/resetOnLocationChange.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest';
+
+import { resetOnLocationChange, routeResetKey } from './resetOnLocationChange';
+
+describe('routeResetKey', () => {
+ it('separates two queries on the same path', () => {
+ expect(routeResetKey('/community/skill', '?page=1')).not.toBe(
+ routeResetKey('/community/skill', '?page=2'),
+ );
+ });
+});
+
+describe('resetOnLocationChange', () => {
+ const error = new Error('boom');
+
+ it('keeps the failure while the location is unchanged', () => {
+ expect(resetOnLocationChange('/eval', { error, resetKey: '/eval' })).toBeNull();
+ });
+
+ it('clears the failure when the pathname changes', () => {
+ expect(
+ resetOnLocationChange('/community/model', { error, resetKey: '/community/agent' }),
+ ).toEqual({ error: undefined, resetKey: '/community/model' });
+ });
+
+ it('clears the failure when only the query changes', () => {
+ expect(
+ resetOnLocationChange('/community/skill?page=2', {
+ error,
+ resetKey: '/community/skill?page=1',
+ }),
+ ).toEqual({ error: undefined, resetKey: '/community/skill?page=2' });
+ });
+});
diff --git a/src/components/SuspenseRouteBoundary/resetOnLocationChange.ts b/src/components/SuspenseRouteBoundary/resetOnLocationChange.ts
new file mode 100644
index 00000000000..bb5d59bd715
--- /dev/null
+++ b/src/components/SuspenseRouteBoundary/resetOnLocationChange.ts
@@ -0,0 +1,26 @@
+export interface RouteBoundaryState {
+ error?: Error;
+ resetKey: string;
+}
+
+/**
+ * The location identity the boundary resets on. Pathname alone is not enough:
+ * the community lists derive their SWR keys from the query string, so a failed
+ * page / filter / ordering request has to clear when the user moves to a
+ * different query on the same path.
+ */
+export const routeResetKey = (pathname: string, search: string) => `${pathname}${search}`;
+
+/**
+ * Clear a stale failure when the route changes, without remounting the healthy
+ * subtree — the boundary lives in a persistent area layout, so keying it would
+ * throw away the scroll position and local state of every route it wraps.
+ */
+export const resetOnLocationChange = (
+ resetKey: string,
+ state: RouteBoundaryState,
+): RouteBoundaryState | null => {
+ if (resetKey === state.resetKey) return null;
+
+ return { error: undefined, resetKey };
+};
diff --git a/src/components/SuspenseRouteBoundary/useRouteRetry.test.ts b/src/components/SuspenseRouteBoundary/useRouteRetry.test.ts
new file mode 100644
index 00000000000..a332eea7d70
--- /dev/null
+++ b/src/components/SuspenseRouteBoundary/useRouteRetry.test.ts
@@ -0,0 +1,85 @@
+import { renderHook, waitFor } from '@testing-library/react';
+import { createElement, type ReactNode } from 'react';
+import useSWR, { SWRConfig } from 'swr';
+import { describe, expect, it, vi } from 'vitest';
+
+import { useRouteRetry } from './useRouteRetry';
+
+const wrapper = ({ children }: { children: ReactNode }) =>
+ createElement(
+ SWRConfig,
+ {
+ value: {
+ dedupingInterval: 0,
+ provider: () => new Map(),
+ revalidateOnFocus: false,
+ shouldRetryOnError: false,
+ },
+ },
+ children,
+ );
+
+describe('useRouteRetry', () => {
+ it('revalidates only the keys that failed, leaving the rest of the cache alone', async () => {
+ const shellFetcher = vi.fn().mockResolvedValue('shell');
+ const routeFetcher = vi.fn().mockResolvedValue('route');
+
+ const { result } = renderHook(
+ () => ({
+ retry: useRouteRetry(),
+ route: useSWR('route-key', routeFetcher),
+ shell: useSWR('shell-key', shellFetcher),
+ }),
+ { wrapper },
+ );
+
+ await waitFor(() => {
+ expect(result.current.shell.data).toBe('shell');
+ expect(result.current.route.data).toBe('route');
+ });
+ expect(shellFetcher).toHaveBeenCalledTimes(1);
+ expect(routeFetcher).toHaveBeenCalledTimes(1);
+
+ result.current.retry.onError(new Error('boom'), 'route-key');
+ result.current.retry.onReset();
+
+ await waitFor(() => expect(routeFetcher).toHaveBeenCalledTimes(2));
+ expect(shellFetcher).toHaveBeenCalledTimes(1);
+ });
+
+ it('does nothing when no key has failed', async () => {
+ const shellFetcher = vi.fn().mockResolvedValue('shell');
+
+ const { result } = renderHook(
+ () => ({ retry: useRouteRetry(), shell: useSWR('shell-key', shellFetcher) }),
+ { wrapper },
+ );
+
+ await waitFor(() => expect(result.current.shell.data).toBe('shell'));
+
+ result.current.retry.onReset();
+
+ await new Promise((resolve) => setTimeout(resolve, 10));
+ expect(shellFetcher).toHaveBeenCalledTimes(1);
+ });
+
+ it('clears the recorded keys so a later reset does not replay them', async () => {
+ const routeFetcher = vi.fn().mockResolvedValue('route');
+
+ const { result } = renderHook(
+ () => ({ retry: useRouteRetry(), route: useSWR('route-key', routeFetcher) }),
+ { wrapper },
+ );
+
+ await waitFor(() => expect(result.current.route.data).toBe('route'));
+
+ result.current.retry.onError(new Error('boom'), 'route-key');
+ result.current.retry.onReset();
+ await waitFor(() => expect(routeFetcher).toHaveBeenCalledTimes(2));
+
+ result.current.retry.onReset();
+
+ await new Promise((resolve) => setTimeout(resolve, 10));
+ expect(routeFetcher).toHaveBeenCalledTimes(2);
+ });
+});
diff --git a/src/components/SuspenseRouteBoundary/useRouteRetry.ts b/src/components/SuspenseRouteBoundary/useRouteRetry.ts
new file mode 100644
index 00000000000..5ed6cdbd1f5
--- /dev/null
+++ b/src/components/SuspenseRouteBoundary/useRouteRetry.ts
@@ -0,0 +1,31 @@
+import { useCallback } from 'react';
+import { useSWRConfig } from 'swr';
+
+import { useSingleton } from '@/hooks/useSingleton';
+
+/**
+ * A thrown SWR error carries no key, so the only way for the route's Retry to
+ * revalidate what actually failed is to record the keys as they fail. Without
+ * this the reset has to match the whole cache, and one route's Retry refetches
+ * every mounted consumer in the app.
+ */
+export const useRouteRetry = () => {
+ const { mutate } = useSWRConfig();
+ const failedKeys = useSingleton(() => new Set<string>());
+
+ const onError = useCallback(
+ (_error: unknown, key: string) => {
+ failedKeys.add(key);
+ },
+ [failedKeys],
+ );
+
+ const onReset = useCallback(() => {
+ if (failedKeys.size === 0) return;
+ const keys = new Set(failedKeys);
+ failedKeys.clear();
+ mutate((key) => typeof key === 'string' && keys.has(key), undefined, { revalidate: true });
+ }, [failedKeys, mutate]);
+
+ return { onError, onReset };
+};
diff --git a/src/features/AgentBuilder/SuggestionChips/index.tsx b/src/features/AgentBuilder/SuggestionChips/index.tsx
index 42a8506372b..f86971d32f0 100644
--- a/src/features/AgentBuilder/SuggestionChips/index.tsx
+++ b/src/features/AgentBuilder/SuggestionChips/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Block, Flexbox, Skeleton as LobeSkeleton } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { ActionIcon, Skeleton, Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { RefreshCw } from 'lucide-react';
import { memo, useCallback } from 'react';
@@ -66,24 +66,8 @@ const ChipItem = memo<ChipItemProps>(({ title, prompt, index, tracingId, disable
const ChipSkeleton = memo(() => (
<Block style={{ borderRadius: cssVar.borderRadiusLG }} variant={'outlined'}>
<Flexbox gap={8} paddingBlock={12} paddingInline={14}>
- <LobeSkeleton.Button
- active
- size={'small'}
- style={{ borderRadius: 4, height: 14, minWidth: 96, width: 96 }}
- />
- <Flexbox gap={6}>
- <LobeSkeleton.Button
- active
- block
- size={'small'}
- style={{ borderRadius: 4, height: 10, minWidth: '100%' }}
- />
- <LobeSkeleton.Button
- active
- size={'small'}
- style={{ borderRadius: 4, height: 10, minWidth: '60%', width: '60%' }}
- />
- </Flexbox>
+ <Skeleton.Text fontSize={14} width={96} />
+ <Skeleton.Text rows={2} width={['100%', '60%']} />
</Flexbox>
</Block>
));
diff --git a/src/features/AgentDocumentPage/Layout/index.tsx b/src/features/AgentDocumentPage/Layout/index.tsx
index 6bf505a503d..a03b1c8c35f 100644
--- a/src/features/AgentDocumentPage/Layout/index.tsx
+++ b/src/features/AgentDocumentPage/Layout/index.tsx
@@ -2,7 +2,9 @@
import { Flexbox } from '@lobehub/ui';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import { NavPanelPortal } from '@/features/NavPanel/NavPanelPortal';
import AgentDocumentSidebarContent from '../RightPanel';
@@ -20,7 +22,11 @@ const AgentDocumentLayout = () => (
width={'100%'}
>
<Flexbox flex={1} style={{ minHeight: 0, minWidth: 0 }}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
</Flexbox>
</>
diff --git a/src/features/AgentHome/AgentInfo.tsx b/src/features/AgentHome/AgentInfo.tsx
index f0679f40319..2fa14ace887 100644
--- a/src/features/AgentHome/AgentInfo.tsx
+++ b/src/features/AgentHome/AgentInfo.tsx
@@ -1,8 +1,8 @@
'use client';
import { agentDisplayName } from '@lobechat/types';
-import { Flexbox, Markdown, Skeleton } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Markdown } from '@lobehub/ui';
+import { Skeleton, Text } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -45,10 +45,10 @@ const AgentInfo = memo(() => {
if (isLoading) {
return (
<Flexbox gap={12}>
- <Skeleton.Avatar active shape={'square'} size={64} />
- <Skeleton.Button active style={{ height: 32, width: 200 }} />
+ <Skeleton.Avatar shape={'square'} size={64} />
+ <Skeleton height={32} width={200} />
<Flexbox width={'min(100%, 640px)'}>
- <Skeleton active paragraph={{ rows: 2 }} title={false} />
+ <Skeleton.Text rows={2} />
</Flexbox>
</Flexbox>
);
diff --git a/src/features/AgentProfileCard/AgentProfilePopup.tsx b/src/features/AgentProfileCard/AgentProfilePopup.tsx
index 2e08614bfa1..f624b3a3e68 100644
--- a/src/features/AgentProfileCard/AgentProfilePopup.tsx
+++ b/src/features/AgentProfileCard/AgentProfilePopup.tsx
@@ -2,8 +2,8 @@
import { agentDisplayName, type AgentItem } from '@lobechat/types';
import { ModelIcon } from '@lobehub/icons';
-import { Flexbox, Icon, Popover, Skeleton } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, Popover } from '@lobehub/ui';
+import { ActionIcon, Skeleton, Text } from '@lobehub/ui/base-ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { createStaticStyles } from 'antd-style';
import { BookOpen, FileText, Settings } from 'lucide-react';
@@ -11,6 +11,7 @@ import { memo, type PropsWithChildren, useState } from 'react';
import { useTranslation } from 'react-i18next';
import useSWR from 'swr';
+import { ArticleSkeleton } from '@/components/Skeleton';
import ModelSelect from '@/features/ModelSelect';
import { useResourceAccess } from '@/features/ResourcePermission/useResourceAccess';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
@@ -156,8 +157,8 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(
)
) : footerLoading ? (
<Flexbox horizontal align={'center'} className={styles.footer} gap={14}>
- <Skeleton.Button active size={'small'} style={{ height: 16, width: 90 }} />
- <Skeleton.Button active size={'small'} style={{ height: 16, width: 60 }} />
+ <Skeleton height={16} width={90} />
+ <Skeleton height={16} width={60} />
</Flexbox>
) : canConfigure && (merged.model || hasStats) ? (
<Flexbox horizontal align={'center'} className={styles.footer} gap={14} wrap={'wrap'}>
@@ -198,7 +199,7 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(
const content = showSkeleton ? (
<div style={{ padding: 16, width: 280 }}>
- <Skeleton active avatar paragraph={{ rows: 2 }} />
+ <ArticleSkeleton avatar rows={2} />
</div>
) : (
<AgentProfileCard
diff --git a/src/features/AgentProfileCard/index.tsx b/src/features/AgentProfileCard/index.tsx
index fbe97648a98..c63d63c15ed 100644
--- a/src/features/AgentProfileCard/index.tsx
+++ b/src/features/AgentProfileCard/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Center, Flexbox, Skeleton, Tooltip } from '@lobehub/ui';
-import { Avatar, Text } from '@lobehub/ui/base-ui';
+import { Center, Flexbox, Tooltip } from '@lobehub/ui';
+import { Avatar, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo, type ReactNode } from 'react';
@@ -132,11 +132,10 @@ const AgentProfileCard = memo<AgentProfileCardProps>(
</Text>
</Tooltip>
) : loading ? (
- <Skeleton
- active
+ <Skeleton.Text
className={styles.descriptionSkeleton}
- paragraph={{ rows: 2, width: ['100%', '60%'] }}
- title={false}
+ rows={2}
+ width={['100%', '60%']}
/>
) : null}
</Flexbox>
diff --git a/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx b/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx
index 584044ef5a9..a818b46de6d 100644
--- a/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx
+++ b/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx
@@ -2,8 +2,15 @@
import type { QuotaLimitReading } from '@lobechat/heterogeneous-agents/quota';
import { projectWindows } from '@lobechat/heterogeneous-agents/quota';
-import { Flexbox, Icon, Skeleton, Tooltip } from '@lobehub/ui';
-import { ActionIcon, createModal, type ModalInstance, Segmented, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import {
+ ActionIcon,
+ createModal,
+ type ModalInstance,
+ Segmented,
+ Skeleton,
+ Text,
+} from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import dayjs from 'dayjs';
import type { TFunction } from 'i18next';
@@ -882,8 +889,8 @@ const QuotaCalendar = memo<QuotaCalendarProps>(({ externalAccountId }) => {
if (loading)
return (
<Flexbox gap={12}>
- <Skeleton.Button active block style={{ height: 170 }} />
- <Skeleton.Button active block style={{ height: 320 }} />
+ <Skeleton height={170} />
+ <Skeleton height={320} />
</Flexbox>
);
diff --git a/src/features/AgentSetting/AgentSettings.tsx b/src/features/AgentSetting/AgentSettings.tsx
index d4ce5efe0cf..76210c90cf4 100644
--- a/src/features/AgentSetting/AgentSettings.tsx
+++ b/src/features/AgentSetting/AgentSettings.tsx
@@ -1,6 +1,6 @@
-import { Skeleton } from '@lobehub/ui';
import { memo, Suspense } from 'react';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { ChatSettingsTabs } from '@/store/global/initialState';
import { useServerConfigStore } from '@/store/serverConfig';
@@ -15,7 +15,7 @@ export interface AgentSettingsProps extends StoreUpdaterProps {
const AgentSettings = memo<AgentSettingsProps>(({ tab = ChatSettingsTabs.Opening, ...rest }) => {
const isMobile = useServerConfigStore((s) => s.isMobile);
const loadingSkeleton = (
- <Skeleton active paragraph={{ rows: 6 }} style={{ padding: isMobile ? 16 : 0 }} title={false} />
+ <ArticleSkeleton rows={6} style={{ padding: isMobile ? 16 : 0 }} title={false} />
);
return (
diff --git a/src/features/AgentSidebar/Topic/List/Item/index.tsx b/src/features/AgentSidebar/Topic/List/Item/index.tsx
index d60f8fdb95a..91a0f0556bd 100644
--- a/src/features/AgentSidebar/Topic/List/Item/index.tsx
+++ b/src/features/AgentSidebar/Topic/List/Item/index.tsx
@@ -5,8 +5,8 @@ import {
getTopicMetadataWorkingDirectoryEffectivePath,
getTopicMetadataWorkingDirectorySourcePath,
} from '@lobechat/utils/client/topic';
-import { Flexbox, Icon, Popover, Skeleton, Tooltip } from '@lobehub/ui';
-import { Tag, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, Popover, Tooltip } from '@lobehub/ui';
+import { Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, useTheme } from 'antd-style';
import dayjs from 'dayjs';
import isEqual from 'fast-deep-equal';
@@ -490,8 +490,8 @@ const TopicItemRow = memo<TopicItemRowProps>(
<Suspense
fallback={
<Flexbox gap={8} paddingBlock={8} paddingInline={24} width={'100%'}>
- <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
- <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
+ <Skeleton height={18} width={'100%'} />
+ <Skeleton height={18} width={'100%'} />
</Flexbox>
}
>
diff --git a/src/features/AgentSidebar/Topic/List/TopicListSkeleton.tsx b/src/features/AgentSidebar/Topic/List/TopicListSkeleton.tsx
index 354ee3701ca..72b76627c48 100644
--- a/src/features/AgentSidebar/Topic/List/TopicListSkeleton.tsx
+++ b/src/features/AgentSidebar/Topic/List/TopicListSkeleton.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo } from 'react';
@@ -14,8 +15,7 @@ const GROUPS = [
const RowSkeleton = memo<{ width: string }>(({ width }) => (
<Flexbox horizontal align={'center'} gap={8} height={36} paddingInline={4}>
- <Skeleton.Button
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadiusSM,
height: 16,
@@ -25,9 +25,7 @@ const RowSkeleton = memo<{ width: string }>(({ width }) => (
}}
/>
<Flexbox flex={1}>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 14,
@@ -49,8 +47,7 @@ const TopicListSkeleton = memo(() => (
{GROUPS.map((group, i) => (
<Flexbox gap={1} key={i} paddingBlock={4} paddingInline={'8px 4px'}>
<Flexbox horizontal align={'center'} height={24}>
- <Skeleton.Button
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadiusSM,
height: 12,
diff --git a/src/features/AgentSkillDetail/index.tsx b/src/features/AgentSkillDetail/index.tsx
index 520f2b5c1b2..8efd94e3edf 100644
--- a/src/features/AgentSkillDetail/index.tsx
+++ b/src/features/AgentSkillDetail/index.tsx
@@ -4,13 +4,13 @@ import { type SkillResourceTreeNode } from '@lobechat/types';
import { Github } from '@lobehub/icons';
import { Flexbox, Icon } from '@lobehub/ui';
import { ActionIcon } from '@lobehub/ui/base-ui';
-import { Skeleton } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import { DotIcon, ExternalLinkIcon } from 'lucide-react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import PublishedTime from '@/components/PublishedTime';
+import { ArticleSkeleton } from '@/components/Skeleton';
import SkillAvatar from '@/components/SkillAvatar';
import FileTree, { FileTreeSkeleton } from '@/features/FileTree';
import { useToolStore } from '@/store/tool';
@@ -90,7 +90,7 @@ const AgentSkillDetail = memo<AgentSkillDetailProps>(({ skillId }) => {
return (
<Flexbox style={{ height: '100%', overflow: 'hidden' }}>
<div className={styles.meta}>
- <Skeleton active paragraph={{ rows: 1 }} style={{ margin: 0 }} title={{ width: 220 }} />
+ <ArticleSkeleton rows={1} style={{ margin: 0 }} title={220} />
</div>
<Flexbox horizontal style={{ flex: 1, overflow: 'hidden' }}>
<div className={styles.left}>
@@ -98,7 +98,7 @@ const AgentSkillDetail = memo<AgentSkillDetailProps>(({ skillId }) => {
</div>
<div className={styles.divider} />
<div className={styles.right}>
- <Skeleton active paragraph={{ rows: 8 }} style={{ padding: 16 }} />
+ <ArticleSkeleton rows={8} style={{ padding: 16 }} />
</div>
</Flexbox>
</Flexbox>
diff --git a/src/features/AgentSkillEdit/index.tsx b/src/features/AgentSkillEdit/index.tsx
index 9030fa9d9d4..a38fb15fb65 100644
--- a/src/features/AgentSkillEdit/index.tsx
+++ b/src/features/AgentSkillEdit/index.tsx
@@ -5,11 +5,12 @@ import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
import { type SkillResourceTreeNode } from '@lobechat/types';
import { Flexbox } from '@lobehub/ui';
import { Alert, Button, Drawer, toast } from '@lobehub/ui/base-ui';
-import { Form as AForm, Popconfirm, Skeleton } from 'antd';
+import { Form as AForm, Popconfirm } from 'antd';
import { createStaticStyles } from 'antd-style';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import ContentViewer from '@/features/AgentSkillDetail/ContentViewer';
import FileTree from '@/features/FileTree';
import { usePermission } from '@/hooks/usePermission';
@@ -75,7 +76,7 @@ const AgentSkillEdit = memo<AgentSkillEditProps>(({ skillId, open, onClose }) =>
const deleteAgentSkill = useToolStore((s) => s.deleteAgentSkill);
const skillDetail = data?.skillDetail;
- const resourceTree = data?.resourceTree ?? [];
+ const resourceTree = useMemo(() => data?.resourceTree ?? [], [data?.resourceTree]);
const contentMap = useMemo(() => buildContentMap(resourceTree), [resourceTree]);
const initialValues: SkillEditFormValues = useMemo(
@@ -159,7 +160,7 @@ const AgentSkillEdit = memo<AgentSkillEditProps>(({ skillId, open, onClose }) =>
onClose={onClose}
>
{isLoading ? (
- <Skeleton active paragraph={{ rows: 8 }} style={{ padding: 16 }} />
+ <ArticleSkeleton rows={8} style={{ padding: 16 }} />
) : (
<Flexbox
horizontal
diff --git a/src/features/AgentTasks/AgentTaskList/KanbanColumn.tsx b/src/features/AgentTasks/AgentTaskList/KanbanColumn.tsx
index 9bf09361a56..4f314b23d54 100644
--- a/src/features/AgentTasks/AgentTaskList/KanbanColumn.tsx
+++ b/src/features/AgentTasks/AgentTaskList/KanbanColumn.tsx
@@ -1,7 +1,7 @@
import { useDndContext, useDraggable, useDroppable } from '@dnd-kit/core';
import type { TaskStatus } from '@lobechat/types';
-import { type DropdownItem, DropdownMenu, Icon, Skeleton } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { type DropdownItem, DropdownMenu, Icon } from '@lobehub/ui';
+import { ActionIcon, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { EyeOff, MoreHorizontal, Plus } from 'lucide-react';
import { memo, useMemo } from 'react';
@@ -250,13 +250,12 @@ const KanbanColumn = memo<KanbanColumnProps>(
{headerVariant === 'loading' ? (
<>
<Skeleton.Avatar
- active
shape={'square'}
size={16}
style={{ borderRadius: 4, flex: 'none' }}
/>
- <Skeleton.Button active style={{ height: 14, minWidth: 64, width: 64 }} />
- <Skeleton.Button active style={{ height: 12, minWidth: 20, width: 20 }} />
+ <Skeleton height={14} style={{ minWidth: 64 }} width={64} />
+ <Skeleton height={12} style={{ minWidth: 20 }} width={20} />
</>
) : headerVariant === 'group' && groupMeta ? (
<>
diff --git a/src/features/AgentTasks/AgentTaskList/TaskItemSkeleton.tsx b/src/features/AgentTasks/AgentTaskList/TaskItemSkeleton.tsx
index 665c40f894d..650699eaa86 100644
--- a/src/features/AgentTasks/AgentTaskList/TaskItemSkeleton.tsx
+++ b/src/features/AgentTasks/AgentTaskList/TaskItemSkeleton.tsx
@@ -1,4 +1,5 @@
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
interface TaskItemSkeletonProps {
@@ -10,26 +11,16 @@ const TaskItemSkeleton = memo<TaskItemSkeletonProps>(({ variant = 'default' }) =
return (
<Block gap={8} padding={12} variant={'borderless'}>
<Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>
- <Skeleton.Button active style={{ height: 14, minWidth: 60, width: 60 }} />
- <Skeleton.Avatar active shape={'circle'} size={'small'} />
+ <Skeleton height={14} style={{ minWidth: 60 }} width={60} />
+ <Skeleton.Avatar shape={'circle'} size={'small'} />
</Flexbox>
<Flexbox horizontal align={'center'} gap={8}>
- <Skeleton.Avatar
- active
- shape={'square'}
- size={16}
- style={{ borderRadius: 4, flex: 'none' }}
- />
- <Skeleton.Button active block style={{ height: 16 }} />
+ <Skeleton.Avatar shape={'square'} size={16} style={{ borderRadius: 4, flex: 'none' }} />
+ <Skeleton height={16} />
</Flexbox>
<Flexbox horizontal align={'center'} gap={8}>
- <Skeleton.Avatar
- active
- shape={'square'}
- size={14}
- style={{ borderRadius: 4, flex: 'none' }}
- />
- <Skeleton.Button active style={{ height: 12, minWidth: 48, width: 48 }} />
+ <Skeleton.Avatar shape={'square'} size={14} style={{ borderRadius: 4, flex: 'none' }} />
+ <Skeleton height={12} style={{ minWidth: 48 }} width={48} />
</Flexbox>
</Block>
);
@@ -39,27 +30,17 @@ const TaskItemSkeleton = memo<TaskItemSkeletonProps>(({ variant = 'default' }) =
<Block gap={8} padding={12} variant={'borderless'}>
<Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>
<Flexbox horizontal align={'center'} gap={8} style={{ flex: 1, minWidth: 0 }}>
- <Skeleton.Avatar
- active
- shape={'square'}
- size={16}
- style={{ borderRadius: 4, flex: 'none' }}
- />
- <Skeleton.Avatar
- active
- shape={'square'}
- size={16}
- style={{ borderRadius: 4, flex: 'none' }}
- />
- <Skeleton.Button active style={{ height: 14, minWidth: 64, width: 64 }} />
- <Skeleton.Button active style={{ height: 16, minWidth: 200, width: 200 }} />
+ <Skeleton.Avatar shape={'square'} size={16} style={{ borderRadius: 4, flex: 'none' }} />
+ <Skeleton.Avatar shape={'square'} size={16} style={{ borderRadius: 4, flex: 'none' }} />
+ <Skeleton height={14} style={{ minWidth: 64 }} width={64} />
+ <Skeleton height={16} style={{ minWidth: 200 }} width={200} />
</Flexbox>
<Flexbox horizontal align={'center'} flex={'none'} gap={8}>
- <Skeleton.Avatar active shape={'circle'} size={'small'} />
- <Skeleton.Button active style={{ height: 12, minWidth: 40, width: 40 }} />
+ <Skeleton.Avatar shape={'circle'} size={'small'} />
+ <Skeleton height={12} style={{ minWidth: 40 }} width={40} />
</Flexbox>
</Flexbox>
- <Skeleton.Button active style={{ height: 14, minWidth: 0, width: '60%' }} />
+ <Skeleton height={14} style={{ minWidth: 0 }} width={'60%'} />
</Block>
);
});
diff --git a/src/features/AgentTasks/features/icons/PriorityLowIcon.tsx b/src/features/AgentTasks/features/icons/PriorityLowIcon.tsx
index 5d5bea1c3d1..429ba40d35b 100644
--- a/src/features/AgentTasks/features/icons/PriorityLowIcon.tsx
+++ b/src/features/AgentTasks/features/icons/PriorityLowIcon.tsx
@@ -18,7 +18,7 @@ const Icon: IconType = memo(({ size = '1em', style, ...rest }) => {
<path d="M3.5 8h-1a1 1 0 00-1 1v4a1 1 0 001 1h1a1 1 0 001-1V9a1 1 0 00-1-1z" />
<path
d="M8.5 5h-1a1 1 0 00-1 1v7a1 1 0 001 1h1a1 1 0 001-1V6a1 1 0 00-1-1zM13.5 2h-1a1 1 0 00-1 1v10a1 1 0 001 1h1a1 1 0 001-1V3a1 1 0 00-1-1z"
- fill-opacity=".4"
+ fillOpacity={0.4}
/>
</svg>
);
diff --git a/src/features/AgentTasks/features/icons/PriorityMediumIcon.tsx b/src/features/AgentTasks/features/icons/PriorityMediumIcon.tsx
index 0927bdec902..3cd44cbee41 100644
--- a/src/features/AgentTasks/features/icons/PriorityMediumIcon.tsx
+++ b/src/features/AgentTasks/features/icons/PriorityMediumIcon.tsx
@@ -18,7 +18,7 @@ const Icon: IconType = memo(({ size = '1em', style, ...rest }) => {
<path d="M3.5 8h-1a1 1 0 00-1 1v4a1 1 0 001 1h1a1 1 0 001-1V9a1 1 0 00-1-1zM8.5 5h-1a1 1 0 00-1 1v7a1 1 0 001 1h1a1 1 0 001-1V6a1 1 0 00-1-1z" />
<path
d="M13.5 2h-1a1 1 0 00-1 1v10a1 1 0 001 1h1a1 1 0 001-1V3a1 1 0 00-1-1z"
- fill-opacity=".4"
+ fillOpacity={0.4}
/>
</svg>
);
diff --git a/src/features/AgentUsage/UsageTrendChart.tsx b/src/features/AgentUsage/UsageTrendChart.tsx
index e8a7d19375d..33b0a42072e 100644
--- a/src/features/AgentUsage/UsageTrendChart.tsx
+++ b/src/features/AgentUsage/UsageTrendChart.tsx
@@ -1,8 +1,8 @@
'use client';
import { BarChart, ChartTooltipFrame, ChartTooltipRow } from '@lobehub/charts';
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
-import { Segmented, Text } from '@lobehub/ui/base-ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Segmented, Skeleton, Text } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -68,7 +68,7 @@ const UsageTrendChart = memo<UsageTrendChartProps>(({ buckets, isLoading }) => {
/>
</Flexbox>
{isLoading ? (
- <Skeleton.Block height={320} />
+ <Skeleton height={320} />
) : (
<BarChart
showLegend
diff --git a/src/features/Auth/OAuthConsent/InteractionDetailsSkeleton.tsx b/src/features/Auth/OAuthConsent/InteractionDetailsSkeleton.tsx
index 38a3b6cf57f..7e9befdd225 100644
--- a/src/features/Auth/OAuthConsent/InteractionDetailsSkeleton.tsx
+++ b/src/features/Auth/OAuthConsent/InteractionDetailsSkeleton.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
import AuthCard from '@/features/AuthCard';
@@ -8,31 +9,31 @@ import AuthCard from '@/features/AuthCard';
const InteractionDetailsSkeleton = memo(() => (
<Flexbox gap={16} width={'min(100%,400px)'}>
<Flexbox horizontal align={'center'} justify={'center'} width={'100%'}>
- <Skeleton.Avatar active shape={'square'} size={72} />
+ <Skeleton.Avatar shape={'square'} size={72} />
</Flexbox>
<AuthCard
- title={<Skeleton.Button active block style={{ height: 40 }} />}
+ title={<Skeleton height={40} />}
footer={
<Flexbox gap={12} width={'100%'}>
- <Skeleton.Button active block size="large" />
- <Skeleton.Button active block size="large" />
+ <Skeleton height={36} />
+ <Skeleton height={36} />
</Flexbox>
}
subtitle={
<Flexbox gap={8} width={'100%'}>
- <Skeleton.Button active block style={{ height: 22 }} />
- <Skeleton.Button active style={{ height: 22, width: '72%' }} />
+ <Skeleton height={22} />
+ <Skeleton height={22} width={'72%'} />
</Flexbox>
}
>
<Flexbox gap={12} width={'100%'}>
- <Skeleton.Button active style={{ height: 22, width: '54%' }} />
+ <Skeleton height={22} width={'54%'} />
<Flexbox gap={8} width={'100%'}>
<Block padding={16} variant={'filled'}>
- <Skeleton.Button active block />
+ <Skeleton height={36} />
</Block>
<Block padding={16} variant={'filled'}>
- <Skeleton.Button active style={{ width: '68%' }} />
+ <Skeleton width={'68%'} />
</Block>
</Flexbox>
</Flexbox>
diff --git a/src/features/Auth/OAuthConsent/Login.tsx b/src/features/Auth/OAuthConsent/Login.tsx
index f0e7b3540ab..8e2777fd4c5 100644
--- a/src/features/Auth/OAuthConsent/Login.tsx
+++ b/src/features/Auth/OAuthConsent/Login.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
-import { Avatar, Button, Text } from '@lobehub/ui/base-ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Avatar, Button, Skeleton, Text } from '@lobehub/ui/base-ui';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -77,8 +77,8 @@ const LoginConfirmClient = memo<LoginConfirmProps>(({ uid, clientMetadata }) =>
</Flexbox>
) : (
<Flexbox horizontal gap={16}>
- <Skeleton.Avatar active shape={'square'} size={40} />
- <Skeleton.Button active />
+ <Skeleton.Avatar shape={'square'} size={40} />
+ <Skeleton height={36} />
</Flexbox>
)}
</Block>
diff --git a/src/features/ChatInput/ActionBar/components/ActionPopover.tsx b/src/features/ChatInput/ActionBar/components/ActionPopover.tsx
index 04ba0333137..6ae02a6414d 100644
--- a/src/features/ChatInput/ActionBar/components/ActionPopover.tsx
+++ b/src/features/ChatInput/ActionBar/components/ActionPopover.tsx
@@ -85,7 +85,6 @@ const ActionPopover = memo<ActionPopoverProps>(
return (
<Popover
content={popoverContent}
- nativeButton={false}
placement={isMobile ? 'top' : placement}
classNames={{
...(typeof resolvedClassNames === 'object' ? resolvedClassNames : {}),
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx
index 2d1636838c8..25b3c09fa3e 100644
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.test.tsx
@@ -245,6 +245,9 @@ vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({
/>
),
confirmModal: confirmModalMock,
+ Skeleton: ({ height }: { height?: number }) => (
+ <div data-height={height} data-testid="skeleton" />
+ ),
toast: {
error: toastErrorMock,
success: toastSuccessMock,
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx
index e94a25d6f81..dc6cd28b201 100644
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaMenu.tsx
@@ -1,8 +1,8 @@
'use client';
import type { HeteroQuotaWindow } from '@lobechat/electron-client-ipc';
-import { Flexbox, Icon, Popover, Skeleton, Tooltip } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, Popover, Tooltip } from '@lobehub/ui';
+import { ActionIcon, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import { ChevronDownIcon, GaugeIcon, RefreshCwIcon } from 'lucide-react';
import type { ReactNode } from 'react';
@@ -585,9 +585,9 @@ const QuotaMenu = <S extends QuotaSnapshotBase>({
{loading && !hasQuotaData ? (
<Flexbox gap={8}>
- <Skeleton.Button active block size="small" style={{ height: 18 }} />
- <Skeleton.Button active block size="small" style={{ height: 18 }} />
- <Skeleton.Button active block size="small" style={{ height: 18 }} />
+ <Skeleton height={18} />
+ <Skeleton height={18} />
+ <Skeleton height={18} />
</Flexbox>
) : quota?.status === 'unavailable' ? (
<div className={styles.emptyState}>
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/index.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/index.tsx
index cc70e120d1f..8b8b4f57f5c 100644
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/index.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/index.tsx
@@ -6,7 +6,8 @@ import {
type HeterogeneousAgentRuntimeStatus,
useWatchBroadcast,
} from '@lobechat/electron-client-ipc';
-import { Flexbox, Icon, Skeleton, Tooltip } from '@lobehub/ui';
+import { Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import { ActivityIcon, CircleAlertIcon, RadioTowerIcon, TimerResetIcon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -208,8 +209,8 @@ const HeteroControlBar = memo(() => {
if (!agentId || isLoading) {
return (
<Flexbox horizontal align={'center'} className={styles.bar} gap={4} justify={'space-between'}>
- <Skeleton.Button active size="small" style={{ height: 22, minWidth: 100, width: 100 }} />
- <Skeleton.Button active size="small" style={{ height: 22, minWidth: 80, width: 80 }} />
+ <Skeleton style={{ height: 22, minWidth: 100, width: 100 }} />
+ <Skeleton style={{ height: 22, minWidth: 80, width: 80 }} />
</Flexbox>
);
}
diff --git a/src/features/ChatInput/ControlBar/index.tsx b/src/features/ChatInput/ControlBar/index.tsx
index 232c8dbbd2c..2eaac127a01 100644
--- a/src/features/ChatInput/ControlBar/index.tsx
+++ b/src/features/ChatInput/ControlBar/index.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
@@ -60,8 +61,8 @@ const ControlBar = memo(() => {
if (!agentId || isLoading) {
return (
<Flexbox horizontal align={'center'} className={styles.bar} gap={4}>
- <Skeleton.Button active size="small" style={{ height: 22, minWidth: 64, width: 64 }} />
- <Skeleton.Button active size="small" style={{ height: 22, minWidth: 100, width: 100 }} />
+ <Skeleton style={{ height: 22, minWidth: 64, width: 64 }} />
+ <Skeleton style={{ height: 22, minWidth: 100, width: 100 }} />
</Flexbox>
);
}
diff --git a/src/features/ChatInput/Desktop/index.tsx b/src/features/ChatInput/Desktop/index.tsx
index 325a998f84f..94ca3caa073 100644
--- a/src/features/ChatInput/Desktop/index.tsx
+++ b/src/features/ChatInput/Desktop/index.tsx
@@ -2,8 +2,8 @@
import { type ChatInputProps } from '@lobehub/editor/react';
import { ChatInput, ChatInputActionBar } from '@lobehub/editor/react';
-import { Center, Flexbox, Skeleton } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Center, Flexbox } from '@lobehub/ui';
+import { Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { type ReactNode, use } from 'react';
import { memo, useEffect } from 'react';
@@ -185,17 +185,12 @@ const DesktopChatInput = memo<DesktopChatInputProps>(
const loadingLeftSlot = isConfigLoading ? (
<Flexbox horizontal align="center" gap={6} paddingInline={4}>
- <Skeleton.Button active shape="circle" size="small" style={{ height: 28, width: 28 }} />
- <Skeleton.Button active shape="circle" size="small" style={{ height: 28, width: 28 }} />
+ <Skeleton height={28} radius={'50%'} width={28} />
+ <Skeleton height={28} radius={'50%'} width={28} />
</Flexbox>
) : null;
const loadingRightSlot = isConfigLoading ? (
- <Skeleton.Button
- active
- shape="round"
- size="small"
- style={{ height: 32, minWidth: 64, width: 64 }}
- />
+ <Skeleton radius={999} style={{ height: 32, minWidth: 64, width: 64 }} />
) : null;
const noticeNode = !isConfigLoading && <ChatInputNotice />;
// The action bar is `width: 100%`, so a sibling placed *inside* its
diff --git a/src/features/CommunitySkillDetail/Details/Reviews/index.tsx b/src/features/CommunitySkillDetail/Details/Reviews/index.tsx
index e72b9ad9a60..661eb3308f7 100644
--- a/src/features/CommunitySkillDetail/Details/Reviews/index.tsx
+++ b/src/features/CommunitySkillDetail/Details/Reviews/index.tsx
@@ -1,11 +1,12 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
import { memo, useCallback } from 'react';
import AsyncError from '@/components/AsyncError';
import CommentList, { type CommentListProps } from '@/components/CommentList';
import RatingOverview from '@/components/RatingOverview';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { discoverService } from '@/services/discover';
import { useDiscoverStore } from '@/store/discover';
@@ -47,7 +48,7 @@ const Reviews = memo(() => {
{isLoading ? (
<Flexbox gap={24}>
{Array.from({ length: 3 }).map((_, i) => (
- <Skeleton active key={i} paragraph={{ rows: 2 }} title={{ width: 120 }} />
+ <ArticleSkeleton key={i} rows={2} title={120} />
))}
</Flexbox>
) : error ? (
diff --git a/src/features/CommunitySkillDetail/Loading.tsx b/src/features/CommunitySkillDetail/Loading.tsx
index 62eb752cf77..9b8d8ab181e 100644
--- a/src/features/CommunitySkillDetail/Loading.tsx
+++ b/src/features/CommunitySkillDetail/Loading.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
const navSkeletonWidths = [88, 72, 82, 58];
@@ -8,24 +9,24 @@ const navSkeletonWidths = [88, 72, 82, 58];
const Loading = memo(() => (
<Flexbox gap={24} width={'100%'}>
<Flexbox horizontal align={'center'} gap={20} width={'100%'}>
- <Skeleton.Avatar active shape={'square'} size={88} style={{ borderRadius: 22 }} />
+ <Skeleton.Avatar shape={'square'} size={88} style={{ borderRadius: 22 }} />
<Flexbox flex={1} gap={10}>
- <Skeleton.Button active style={{ height: 28, width: 240 }} />
- <Skeleton.Button active style={{ height: 16, width: 320 }} />
+ <Skeleton height={28} width={240} />
+ <Skeleton height={16} width={320} />
</Flexbox>
</Flexbox>
- <Skeleton.Button active block style={{ borderRadius: 16, height: 78 }} />
+ <Skeleton height={78} radius={16} />
<Flexbox horizontal gap={24} style={{ borderBottom: '1px solid transparent' }}>
{navSkeletonWidths.map((width, i) => (
- <Skeleton.Button active key={i} style={{ height: 40, width }} />
+ <Skeleton height={40} key={i} width={width} />
))}
</Flexbox>
<Flexbox gap={8}>
- <Skeleton.Button active block style={{ height: 18 }} />
- <Skeleton.Button active block style={{ height: 18 }} />
- <Skeleton.Button active style={{ height: 18, width: '78%' }} />
+ <Skeleton height={18} />
+ <Skeleton height={18} />
+ <Skeleton height={18} width={'78%'} />
</Flexbox>
- <Skeleton.Button active block style={{ borderRadius: 8, height: 320 }} />
+ <Skeleton height={320} radius={8} />
</Flexbox>
));
diff --git a/src/features/Conversation/ChatItem/components/ErrorContent.tsx b/src/features/Conversation/ChatItem/components/ErrorContent.tsx
index 73ecfadf1ae..00528725de0 100644
--- a/src/features/Conversation/ChatItem/components/ErrorContent.tsx
+++ b/src/features/Conversation/ChatItem/components/ErrorContent.tsx
@@ -1,5 +1,4 @@
-import { Skeleton } from '@lobehub/ui';
-import { Alert, Button } from '@lobehub/ui/base-ui';
+import { Alert, Button, Skeleton } from '@lobehub/ui/base-ui';
import { RotateCcw } from 'lucide-react';
import { memo, Suspense } from 'react';
import { useTranslation } from 'react-i18next';
@@ -38,9 +37,7 @@ const ErrorContent = memo<ErrorContentProps>(({ customErrorRender, error, id, on
if (!error) return;
if (customErrorRender) {
- return (
- <Suspense fallback={<Skeleton.Button active block />}>{customErrorRender(error)}</Suspense>
- );
+ return <Suspense fallback={<Skeleton height={36} />}>{customErrorRender(error)}</Suspense>;
}
return (
diff --git a/src/features/Conversation/Error/OllamaBizError/index.tsx b/src/features/Conversation/Error/OllamaBizError/index.tsx
index a189af7b7a4..1ffa859a6bd 100644
--- a/src/features/Conversation/Error/OllamaBizError/index.tsx
+++ b/src/features/Conversation/Error/OllamaBizError/index.tsx
@@ -1,12 +1,11 @@
import { type ChatMessageError } from '@lobechat/types';
-import { Skeleton } from '@lobehub/ui';
-import { type AlertProps } from '@lobehub/ui/base-ui';
+import { type AlertProps, Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
import ErrorContent from '@/features/Conversation/ChatItem/components/ErrorContent';
import dynamic from '@/libs/next/dynamic';
-const loading = () => <Skeleton active style={{ width: 300 }} />;
+const loading = () => <Skeleton style={{ width: 300 }} />;
const SetupGuide = dynamic(() => import('../OllamaSetupGuide'), { loading, ssr: false });
diff --git a/src/features/Conversation/Error/index.tsx b/src/features/Conversation/Error/index.tsx
index 6f0b3fe500f..da2164f19b4 100644
--- a/src/features/Conversation/Error/index.tsx
+++ b/src/features/Conversation/Error/index.tsx
@@ -5,8 +5,8 @@ import { AgentRuntimeErrorType, getErrorCodeSpec } from '@lobechat/model-runtime
import { type ChatMessageError, type ErrorType, type IToolErrorType } from '@lobechat/types';
import { ChatErrorType } from '@lobechat/types';
import { isRecord } from '@lobechat/utils/object';
-import { Block, Highlighter, Skeleton } from '@lobehub/ui';
-import { type AlertProps } from '@lobehub/ui/base-ui';
+import { Block, Highlighter } from '@lobehub/ui';
+import { type AlertProps, Skeleton } from '@lobehub/ui/base-ui';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -82,7 +82,7 @@ const loading = () => (
width: '100%',
}}
>
- <Skeleton.Button active block />
+ <Skeleton height={36} />
</Block>
);
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
index 31f440487be..56cf0cc644e 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
@@ -1,7 +1,7 @@
'use client';
import type { VerifyCodingScope } from '@lobechat/types';
-import { Flexbox, Icon, Popover, Skeleton } from '@lobehub/ui';
+import { Flexbox, Icon, Popover } from '@lobehub/ui';
import { Avatar, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import type { TFunction } from 'i18next';
@@ -15,6 +15,7 @@ import {
import { memo, type PropsWithChildren, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { useClientDataSWR } from '@/libs/swr';
import { agentService } from '@/services/agent';
import { documentService } from '@/services/document';
@@ -223,7 +224,7 @@ export const InternalEntityPreview = memo<InternalEntityPreviewProps>(
const content = isLoading ? (
<div className={styles.content}>
- <Skeleton active avatar paragraph={{ rows: 2 }} />
+ <ArticleSkeleton avatar rows={2} />
</div>
) : (
<Flexbox className={styles.content} gap={12}>
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx
index c2beec3585e..f51cb897e46 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx
@@ -7,21 +7,24 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import Render from './index';
-vi.mock('@lobehub/ui/base-ui', () => ({
- ActionIcon: ({ icon: _icon, onClick, title, ...rest }: any) => (
- <button {...rest} aria-label={title} type="button" onClick={onClick} />
- ),
+const mockConst = vi.hoisted(() => ({
+ isDesktop: false,
}));
-let mockIsDesktop = false;
-
vi.mock('@lobechat/const', async (importOriginal) => ({
...((await importOriginal()) as Record<string, unknown>),
get isDesktop() {
- return mockIsDesktop;
+ return mockConst.isDesktop;
},
}));
+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({
+ ...((await importOriginal()) as Record<string, unknown>),
+ ActionIcon: ({ icon: _icon, onClick, title, ...rest }: any) => (
+ <button {...rest} aria-label={title} type="button" onClick={onClick} />
+ ),
+}));
+
// `enableMessageLinkIcon` is read via useUserStore(selector). We drive the
// selector's return value through this module-level flag so each case can flip
// the "Link Icon" setting on/off without a real store.
@@ -93,7 +96,7 @@ const renderLink = (properties: Record<string, unknown>) =>
afterEach(() => {
mockShowIcon = true;
- mockIsDesktop = false;
+ mockConst.isDesktop = false;
vi.restoreAllMocks();
});
@@ -267,7 +270,7 @@ describe('Link Render — internal entities', () => {
});
it('takes over modifier-clicks on desktop, which has no new tab to open', () => {
- mockIsDesktop = true;
+ mockConst.isDesktop = true;
const { getByRole } = renderLink({
linkHref: '/task/T-198',
@@ -320,7 +323,7 @@ describe('Link Render — open an external link in the side browser', () => {
});
it('offers the side-browser action on desktop', () => {
- mockIsDesktop = true;
+ mockConst.isDesktop = true;
const { container } = renderExternal();
const action = container.querySelector('[data-side-browser]')!;
@@ -334,7 +337,7 @@ describe('Link Render — open an external link in the side browser', () => {
});
it('keeps the action OUTSIDE the anchor, or the preload would swallow its click', () => {
- mockIsDesktop = true;
+ mockConst.isDesktop = true;
const { container } = renderExternal();
@@ -345,7 +348,7 @@ describe('Link Render — open an external link in the side browser', () => {
});
it('leaves the anchor itself untouched, so a plain click still opens the system browser', () => {
- mockIsDesktop = true;
+ mockConst.isDesktop = true;
const { container } = renderExternal();
const anchor = container.querySelector('a')!;
@@ -358,13 +361,13 @@ describe('Link Render — open an external link in the side browser', () => {
});
it('hides the action on web', () => {
- mockIsDesktop = false;
+ mockConst.isDesktop = false;
const web = renderExternal();
expect(web.container.querySelector('[data-side-browser]')).toBeNull();
});
it('hides the action for non-web links (mailto) and for portal-bound internal links', () => {
- mockIsDesktop = true;
+ mockConst.isDesktop = true;
const email = renderLink({
linkHref: 'mailto:[email protected]',
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx
index 852fcc7e6a5..ca2c09457eb 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx
@@ -1,7 +1,8 @@
import { getBuiltinRender } from '@lobechat/builtin-tools/renders';
import { getBuiltinStreaming } from '@lobechat/builtin-tools/streamings';
import { LOADING_FLAT } from '@lobechat/const';
-import { AccordionItem, Flexbox, Skeleton } from '@lobehub/ui';
+import { AccordionItem, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import isEqual from 'fast-deep-equal';
import { memo, useEffect, useState } from 'react';
@@ -18,12 +19,12 @@ import Actions from './Actions';
import Inspectors from './Inspector';
const Debug = dynamic(() => import('./Debug'), {
- loading: () => <Skeleton.Block active height={300} width={'100%'} />,
+ loading: () => <Skeleton height={300} width={'100%'} />,
ssr: false,
});
const Detail = dynamic(() => import('./Detail'), {
- loading: () => <Skeleton.Block active height={120} width={'100%'} />,
+ loading: () => <Skeleton height={120} width={'100%'} />,
ssr: false,
});
diff --git a/src/features/Conversation/Messages/Tool/Tool/index.tsx b/src/features/Conversation/Messages/Tool/Tool/index.tsx
index 8861c1ee9d5..21c2de03684 100644
--- a/src/features/Conversation/Messages/Tool/Tool/index.tsx
+++ b/src/features/Conversation/Messages/Tool/Tool/index.tsx
@@ -1,5 +1,6 @@
import { getBuiltinRender } from '@lobechat/builtin-tools/renders';
-import { Accordion, AccordionItem, Flexbox, Skeleton } from '@lobehub/ui';
+import { Accordion, AccordionItem, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { type CSSProperties } from 'react';
import { memo, useState } from 'react';
@@ -10,12 +11,12 @@ import { dataSelectors, messageStateSelectors, useConversationStore } from '../.
import Inspectors from '../../AssistantGroup/Tool/Inspector';
const Debug = dynamic(() => import('../../AssistantGroup/Tool/Debug'), {
- loading: () => <Skeleton.Block active height={300} width={'100%'} />,
+ loading: () => <Skeleton height={300} width={'100%'} />,
ssr: false,
});
const Detail = dynamic(() => import('../../AssistantGroup/Tool/Detail'), {
- loading: () => <Skeleton.Block active height={120} width={'100%'} />,
+ loading: () => <Skeleton height={120} width={'100%'} />,
ssr: false,
});
diff --git a/src/features/Conversation/WorkingSidebar/Overview/index.tsx b/src/features/Conversation/WorkingSidebar/Overview/index.tsx
index fdc8cb5250d..f6a07420dab 100644
--- a/src/features/Conversation/WorkingSidebar/Overview/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/Overview/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Center, Empty, Flexbox, Icon, type IconProps, Skeleton } from '@lobehub/ui';
-import { Button, Tag, Text } from '@lobehub/ui/base-ui';
+import { Center, Empty, Flexbox, Icon, type IconProps } from '@lobehub/ui';
+import { Button, Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import {
@@ -208,7 +208,7 @@ const Overview = memo<OverviewProps>(
{repoType && workingDirectory && isGitLoading ? (
<div className={styles.skeleton}>
- <Skeleton active paragraph={{ rows: 2 }} title={false} />
+ <Skeleton.Text rows={2} />
</div>
) : gitError ? (
<Center className={styles.error} gap={8}>
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
index 7818f424d53..e6d55c5fddc 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
@@ -333,6 +333,9 @@ vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {
</div>
);
},
+ Skeleton: {
+ Text: () => <div data-testid="params-loading" />,
+ },
};
});
diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsx
index 1fa4c2d8043..42be390fe53 100644
--- a/src/features/Conversation/WorkingSidebar/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/index.tsx
@@ -1,7 +1,7 @@
import type { SFSymbol } from '@lobechat/electron-client-ipc';
import { nanoid } from '@lobechat/utils';
-import { Flexbox, Icon, type IconProps, Skeleton } from '@lobehub/ui';
-import { ActionIcon, type DropdownItem, DropdownMenu } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, type IconProps } from '@lobehub/ui';
+import { ActionIcon, type DropdownItem, DropdownMenu, Skeleton } from '@lobehub/ui/base-ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { createStaticStyles, cssVar } from 'antd-style';
import {
@@ -1005,14 +1005,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
{paramsAvailable && activeTab === 'params' && (
<Flexbox className={styles.pane}>
<Suspense
- fallback={
- <Skeleton
- active
- className={styles.paramsLoading}
- paragraph={{ rows: 6 }}
- title={false}
- />
- }
+ fallback={<Skeleton.Text className={styles.paramsLoading} rows={6} />}
>
<ParamsSection />
</Suspense>
diff --git a/src/features/DailyBrief/BriefCardSkeleton.tsx b/src/features/DailyBrief/BriefCardSkeleton.tsx
index fc5363bb1fb..5584ee72ae9 100644
--- a/src/features/DailyBrief/BriefCardSkeleton.tsx
+++ b/src/features/DailyBrief/BriefCardSkeleton.tsx
@@ -1,4 +1,5 @@
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import { cssVar } from 'antd-style';
import { memo } from 'react';
@@ -20,24 +21,23 @@ const BriefCardSkeleton = memo(() => {
style={{ flex: 1, minWidth: 0, overflow: 'hidden' }}
>
<Skeleton.Avatar
- active
shape={'square'}
size={28}
style={{ borderRadius: cssVar.borderRadius, flex: 'none' }}
/>
- <Skeleton.Button active style={{ height: 20, width: 200 }} />
- <Skeleton.Button active style={{ height: 14, width: 72 }} />
+ <Skeleton height={20} width={200} />
+ <Skeleton height={14} width={72} />
</Flexbox>
- <Skeleton.Avatar active shape={'circle'} size={'small'} style={{ flex: 'none' }} />
+ <Skeleton.Avatar shape={'circle'} size={'small'} style={{ flex: 'none' }} />
</Flexbox>
<Divider dashed style={{ marginBlock: 0 }} />
- <Skeleton.Paragraph active fontSize={14} rows={3} style={{ marginBottom: 0 }} />
+ <Skeleton.Text fontSize={14} rows={3} style={{ marginBottom: 0 }} />
<Flexbox horizontal gap={8} style={{ alignSelf: 'flex-end' }}>
- <Skeleton.Button active style={{ height: 32, width: 100 }} />
- <Skeleton.Button active style={{ height: 32, width: 80 }} />
+ <Skeleton height={32} width={100} />
+ <Skeleton height={32} width={80} />
</Flexbox>
</Block>
);
diff --git a/src/features/DesktopOnboarding/index.tsx b/src/features/DesktopOnboarding/index.tsx
index 89622f6e433..72ebcd42a39 100644
--- a/src/features/DesktopOnboarding/index.tsx
+++ b/src/features/DesktopOnboarding/index.tsx
@@ -1,7 +1,8 @@
'use client';
import { APP_WINDOW_MIN_SIZE } from '@lobechat/desktop-bridge';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo, Suspense, useCallback, useEffect, useState } from 'react';
import { useSearchParams } from 'react-router';
@@ -222,14 +223,10 @@ const DesktopOnboardingPage = memo(() => {
fallback={
<Flexbox gap={8}>
<Skeleton.Avatar size={48} />
- <Skeleton
- paragraph={{
- rows: 8,
- }}
- title={{
- fontSize: 24,
- }}
- />
+ <Flexbox gap={16} width={'100%'}>
+ <Skeleton.Text fontSize={24} width={'60%'} />
+ <Skeleton.Text rows={8} />
+ </Flexbox>
</Flexbox>
}
>
diff --git a/src/features/DeviceManager/DeviceManager.tsx b/src/features/DeviceManager/DeviceManager.tsx
index a541deb6924..7ab1c2d9883 100644
--- a/src/features/DeviceManager/DeviceManager.tsx
+++ b/src/features/DeviceManager/DeviceManager.tsx
@@ -2,8 +2,8 @@
import { isDesktop } from '@lobechat/const';
import type { DeviceScope, DeviceVisibility } from '@lobechat/types';
-import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { ActionIcon, Button, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { ActionIcon, Button, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import {
ChevronRightIcon,
@@ -251,7 +251,7 @@ const ListSkeleton = memo<{ withHeader?: boolean }>(({ withHeader }) => (
<Flexbox className={styles.listCol} flex={1}>
{withHeader && (
<Flexbox horizontal align={'center'} className={styles.listHeader}>
- <Skeleton.Button active size={'small'} style={{ height: 16, minWidth: 80, width: 80 }} />
+ <Skeleton style={{ height: 16, minWidth: 80, width: 80 }} />
</Flexbox>
)}
<Flexbox padding={4}>
diff --git a/src/features/DocumentModal/Header.tsx b/src/features/DocumentModal/Header.tsx
index a4f1745581c..d0c82ade60d 100644
--- a/src/features/DocumentModal/Header.tsx
+++ b/src/features/DocumentModal/Header.tsx
@@ -1,10 +1,11 @@
'use client';
-import { copyToClipboard, Flexbox, Skeleton } from '@lobehub/ui';
+import { copyToClipboard, Flexbox } from '@lobehub/ui';
import {
ActionIcon,
Avatar,
DropdownMenu,
+ Skeleton,
Text,
toast,
useModalContext,
@@ -72,11 +73,7 @@ const DocumentModalHeader = memo(() => {
<Flexbox allowShrink horizontal align={'center'} gap={6} style={{ minWidth: 0 }}>
{emoji && <Avatar avatar={emoji} shape={'square'} size={24} />}
{isDocumentLoading && !title ? (
- <Skeleton.Button
- active
- size={'small'}
- style={{ height: 14, minWidth: 120, width: 120 }}
- />
+ <Skeleton style={{ height: 14, minWidth: 120, width: 120 }} />
) : (
<Text ellipsis style={{ minWidth: 0 }} weight={500}>
{title || t('pageEditor.titlePlaceholder')}
diff --git a/src/features/EditorCanvas/DocumentIdMode.test.tsx b/src/features/EditorCanvas/DocumentIdMode.test.tsx
index 4ea09383861..349b2946ff8 100644
--- a/src/features/EditorCanvas/DocumentIdMode.test.tsx
+++ b/src/features/EditorCanvas/DocumentIdMode.test.tsx
@@ -32,7 +32,8 @@ const mockDocumentStore = {
useFetchDocument,
};
-vi.mock('zustand-utils', () => ({
+vi.mock('zustand-utils', async (importOriginal) => ({
+ ...(await importOriginal<object>()),
createStoreUpdater: () => () => undefined,
}));
diff --git a/src/features/EditorCanvas/DocumentIdMode.tsx b/src/features/EditorCanvas/DocumentIdMode.tsx
index 1087a9d106b..7b571452d01 100644
--- a/src/features/EditorCanvas/DocumentIdMode.tsx
+++ b/src/features/EditorCanvas/DocumentIdMode.tsx
@@ -1,13 +1,13 @@
'use client';
import { type IEditor } from '@lobehub/editor';
-import { Skeleton } from '@lobehub/ui';
import { memo, useCallback, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { createStoreUpdater } from 'zustand-utils';
import NotFound from '@/components/404';
import AsyncError from '@/components/AsyncError';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { useSaveDocumentHotkey } from '@/hooks/useHotkeys';
import { useDocumentStore } from '@/store/document';
import { editorSelectors } from '@/store/document/slices/editor';
@@ -21,7 +21,7 @@ import UnsavedChangesGuard from './UnsavedChangesGuard';
*/
const EditorSkeleton = () => (
<div style={{ paddingBlock: 24 }}>
- <Skeleton active paragraph={{ rows: 8 }} />
+ <ArticleSkeleton rows={8} />
</div>
);
diff --git a/src/features/FileTree/Skeleton.tsx b/src/features/FileTree/Skeleton.tsx
index 357357f3773..9708f554186 100644
--- a/src/features/FileTree/Skeleton.tsx
+++ b/src/features/FileTree/Skeleton.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo } from 'react';
@@ -18,9 +19,7 @@ const FileTreeSkeleton = memo<FileTreeSkeletonProps>(({ rows = 8, showRootFile =
<Flexbox gap={2}>
{showRootFile && (
<Flexbox horizontal align={'center'} gap={6} height={ROW_HEIGHT} paddingInline={8}>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 14,
@@ -28,9 +27,7 @@ const FileTreeSkeleton = memo<FileTreeSkeletonProps>(({ rows = 8, showRootFile =
width: 14,
}}
/>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 16,
@@ -55,9 +52,7 @@ const FileTreeSkeleton = memo<FileTreeSkeletonProps>(({ rows = 8, showRootFile =
paddingInline={8}
style={{ paddingInlineStart: 8 + depth * 16 }}
>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 14,
@@ -65,9 +60,7 @@ const FileTreeSkeleton = memo<FileTreeSkeletonProps>(({ rows = 8, showRootFile =
width: 14,
}}
/>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 16,
diff --git a/src/features/GroupAvatar/index.tsx b/src/features/GroupAvatar/index.tsx
index a287004b4bd..75b50d8371e 100644
--- a/src/features/GroupAvatar/index.tsx
+++ b/src/features/GroupAvatar/index.tsx
@@ -1,7 +1,8 @@
'use client';
import { type GroupAvatarProps } from '@lobehub/ui';
-import { GroupAvatar, Skeleton } from '@lobehub/ui';
+import { GroupAvatar } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo, useMemo } from 'react';
@@ -40,7 +41,7 @@ const GroupAvatarComponent = memo<GroupAvatarComponentProps>(
];
}, [avatars, userAvatar, nickName, username]);
- if (loading) return <Skeleton.Avatar active shape={'square'} size={size} />;
+ if (loading) return <Skeleton.Avatar shape={'square'} size={size} />;
return (
<GroupAvatar
diff --git a/src/features/Home/HomeModeContent.tsx b/src/features/Home/HomeModeContent.tsx
index 47d22559faa..0bd4fe42531 100644
--- a/src/features/Home/HomeModeContent.tsx
+++ b/src/features/Home/HomeModeContent.tsx
@@ -2,8 +2,8 @@ import { TASK_STATUSES } from '@lobechat/builtin-tool-task';
import type { RecentItem, TaskStatus } from '@lobechat/types';
import { agentDisplayName } from '@lobechat/types';
import type { FlexboxProps } from '@lobehub/ui';
-import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Avatar, Segmented, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Avatar, Segmented, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import { HashIcon } from 'lucide-react';
import { memo, type ReactNode, useMemo, useState } from 'react';
@@ -252,7 +252,7 @@ interface SkeletonLineProps {
*/
const SkeletonLine = memo<SkeletonLineProps>(({ bar, flex, line, width }) => (
<Flexbox align={'flex-start'} flex={flex} height={line} justify={'center'}>
- <Skeleton.Block active height={bar} width={width} />
+ <Skeleton height={bar} width={width} />
</Flexbox>
));
@@ -278,12 +278,7 @@ const LoadingRows = memo<{ avatarSize?: number; withTime?: boolean }>(
{SKELETON_ROWS.map(({ description, title }, index) => (
<Flexbox horizontal align={'flex-start'} className={styles.rowBox} gap={12} key={index}>
<Flexbox flex={'none'} paddingBlock={3}>
- <Skeleton.Avatar
- active
- className={styles.topicAvatar}
- shape={'circle'}
- size={avatarSize}
- />
+ <Skeleton.Avatar className={styles.topicAvatar} shape={'circle'} size={avatarSize} />
</Flexbox>
<Flexbox className={styles.rowText} gap={3}>
<SkeletonLine bar={14} line={22} width={title} />
diff --git a/src/features/Home/NewModelShortcuts/index.tsx b/src/features/Home/NewModelShortcuts/index.tsx
index 1cacacc9171..a1175fba316 100644
--- a/src/features/Home/NewModelShortcuts/index.tsx
+++ b/src/features/Home/NewModelShortcuts/index.tsx
@@ -1,6 +1,6 @@
import { ModelIcon } from '@lobehub/icons';
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { Avatar, Button, Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { Avatar, Button, Skeleton, Text } from '@lobehub/ui/base-ui';
import { App } from 'antd';
import { createStaticStyles, cx } from 'antd-style';
import { useCallback, useState } from 'react';
@@ -165,14 +165,11 @@ export const NewModelShortcuts = () => {
<Text className={styles.label}>{t('starter.newLabel')}</Text>
{isLoading
? defaultHomeNewModels.map((item, index) => (
- <Skeleton.Button
- active
+ <Skeleton
+ height={24}
key={getShortcutKey(item)}
- style={{
- borderRadius: 8,
- height: 24,
- width: skeletonWidths[index] ?? 104,
- }}
+ radius={8}
+ width={skeletonWidths[index] ?? 104}
/>
))
: items.map((item) => {
diff --git a/src/features/LibraryModal/AssignKnowledgeBase/Loading.tsx b/src/features/LibraryModal/AssignKnowledgeBase/Loading.tsx
index b34abbc3fdf..030fd97b82a 100644
--- a/src/features/LibraryModal/AssignKnowledgeBase/Loading.tsx
+++ b/src/features/LibraryModal/AssignKnowledgeBase/Loading.tsx
@@ -1,9 +1,10 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
const Loading = () => {
return (
<Flexbox>
- <Skeleton paragraph={{ rows: 8 }} title={false} />
+ <Skeleton.Text rows={8} />
</Flexbox>
);
};
diff --git a/src/features/LibraryModal/AssignKnowledgeBase/MasonrySkeleton.tsx b/src/features/LibraryModal/AssignKnowledgeBase/MasonrySkeleton.tsx
index ffe4fc4b049..dc1bf06b6fc 100644
--- a/src/features/LibraryModal/AssignKnowledgeBase/MasonrySkeleton.tsx
+++ b/src/features/LibraryModal/AssignKnowledgeBase/MasonrySkeleton.tsx
@@ -1,4 +1,5 @@
-import { Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
@@ -36,20 +37,13 @@ const MasonrySkeleton = memo<MasonrySkeletonProps>(({ columnCount }) => {
>
{Array.from({ length: itemCount }).map((_, index) => (
<div className={styles.card} key={index}>
- <Skeleton
- active
- avatar={{ shape: 'square', size: 48 }}
- paragraph={{
- rows: 3,
- width: ['100%', '90%', '70%'],
- }}
- style={{
- height: heights[index % heights.length],
- }}
- title={{
- width: '80%',
- }}
- />
+ <Flexbox horizontal align={'flex-start'} gap={16} width={'100%'}>
+ <Skeleton.Avatar size={48} />
+ <Flexbox gap={16} style={{ height: heights[index % heights.length] }} width={'100%'}>
+ <Skeleton.Text width={'80%'} />
+ <Skeleton.Text rows={3} width={['100%', '90%', '70%']} />
+ </Flexbox>
+ </Flexbox>
</div>
))}
</div>
diff --git a/src/features/MCP/MCPDetail/Loading.tsx b/src/features/MCP/MCPDetail/Loading.tsx
index db5bf2975b7..3fc9eae7d70 100644
--- a/src/features/MCP/MCPDetail/Loading.tsx
+++ b/src/features/MCP/MCPDetail/Loading.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo } from 'react';
@@ -7,10 +8,10 @@ const DetailsLoading = memo(() => {
<Flexbox gap={24}>
<Flexbox gap={12}>
<Flexbox horizontal align={'center'} gap={16} width={'100%'}>
- <Skeleton.Avatar active shape={'square'} size={64} />
- <Skeleton.Button active style={{ height: 36, width: 200 }} />
+ <Skeleton.Avatar shape={'square'} size={64} />
+ <Skeleton height={36} width={200} />
</Flexbox>
- <Skeleton.Button active size={'small'} style={{ width: 200 }} />
+ <Skeleton height={28} width={200} />
</Flexbox>
<Flexbox
horizontal
@@ -20,8 +21,8 @@ const DetailsLoading = memo(() => {
borderBottom: `1px solid ${cssVar.colorBorder}`,
}}
>
- <Skeleton.Button />
- <Skeleton.Button />
+ <Skeleton height={36} />
+ <Skeleton height={36} />
</Flexbox>
<Flexbox
flex={1}
@@ -31,9 +32,9 @@ const DetailsLoading = memo(() => {
overflow: 'hidden',
}}
>
- <Skeleton paragraph={{ rows: 3 }} title={false} />
- <Skeleton paragraph={{ rows: 8 }} title={false} />
- <Skeleton paragraph={{ rows: 8 }} title={false} />
+ <Skeleton.Text rows={3} />
+ <Skeleton.Text rows={8} />
+ <Skeleton.Text rows={8} />
</Flexbox>
</Flexbox>
);
diff --git a/src/features/MCPPluginDetail/Agents.tsx b/src/features/MCPPluginDetail/Agents.tsx
index b2b571c3ec4..3a3b3aa9b6a 100644
--- a/src/features/MCPPluginDetail/Agents.tsx
+++ b/src/features/MCPPluginDetail/Agents.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Center, Grid, Icon, Skeleton } from '@lobehub/ui';
+import { Center, Grid, Icon } from '@lobehub/ui';
import { Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { InboxIcon, ServerCrash } from 'lucide-react';
@@ -8,6 +8,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { VirtuosoGrid } from 'react-virtuoso';
+import { ArticleSkeleton } from '@/components/Skeleton';
import AgentItem from '@/features/SkillStore/SkillDetail/AgentItem';
import { agentListStyles as styles } from '@/features/SkillStore/SkillDetail/style';
import VirtuosoLoading from '@/features/SkillStore/SkillList/VirtuosoLoading';
@@ -73,12 +74,7 @@ const Agents = memo<AgentsProps>(({ inModal }) => {
return (
<Grid gap={12} rows={2} width={'100%'}>
{Array.from({ length: 4 }).map((_, index) => (
- <Skeleton
- active
- avatar={{ shape: 'square', size: 40 }}
- key={index}
- paragraph={{ rows: 1 }}
- />
+ <ArticleSkeleton avatar={40} key={index} rows={1} />
))}
</Grid>
);
diff --git a/src/features/Messenger/IntegrationDetail/MessengerPushWindowState.tsx b/src/features/Messenger/IntegrationDetail/MessengerPushWindowState.tsx
index 63ae4c50a49..6481aa373c4 100644
--- a/src/features/Messenger/IntegrationDetail/MessengerPushWindowState.tsx
+++ b/src/features/Messenger/IntegrationDetail/MessengerPushWindowState.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Button, Tag, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Button, Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { CheckCircle2Icon, ClockIcon, MoonIcon, RefreshCwIcon } from 'lucide-react';
import { memo } from 'react';
@@ -85,7 +85,7 @@ export const MessengerPushWindowState = memo<MessengerPushWindowStateProps>(
</Flexbox>
);
- if (!status) return <Skeleton.Button active size="small" style={{ width: 220 }} />;
+ if (!status) return <Skeleton height={28} width={220} />;
if (status.deliverability === 'always')
return (
diff --git a/src/features/Messenger/IntegrationDetail/shared.tsx b/src/features/Messenger/IntegrationDetail/shared.tsx
index 317e8a7c7de..255f2385229 100644
--- a/src/features/Messenger/IntegrationDetail/shared.tsx
+++ b/src/features/Messenger/IntegrationDetail/shared.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Block, Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Button, confirmModal, Select, Tag, Text, toast } from '@lobehub/ui/base-ui';
+import { Block, Flexbox, Icon } from '@lobehub/ui';
+import { Button, confirmModal, Select, Skeleton, Tag, Text, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { ArrowLeftIcon, CheckCircle2Icon, Trash2Icon, UserIcon } from 'lucide-react';
import type { ReactNode } from 'react';
@@ -124,18 +124,18 @@ const ConnectionsSkeleton = memo<{ withNestedContent?: boolean }>(
<Block className={styles.card} key={index}>
<Flexbox gap={12}>
<Flexbox horizontal align="center" gap={12}>
- <Skeleton.Avatar active shape={'square'} size={36} />
+ <Skeleton.Avatar shape={'square'} size={36} />
<Flexbox flex={1} gap={6}>
- <Skeleton.Button active size={'small'} style={{ width: 56 }} />
- <Skeleton.Button active style={{ height: 18, width: '40%' }} />
+ <Skeleton height={28} width={56} />
+ <Skeleton height={18} width={'40%'} />
</Flexbox>
- <Skeleton.Button active size={'small'} style={{ width: 72 }} />
- <Skeleton.Button active size={'small'} style={{ width: 84 }} />
+ <Skeleton height={28} width={72} />
+ <Skeleton height={28} width={84} />
</Flexbox>
{withNestedContent && (
<Flexbox gap={6} style={{ paddingInlineStart: 48 }}>
- <Skeleton.Button active size={'small'} style={{ width: 72 }} />
- <Skeleton.Button active style={{ height: 32, width: '100%' }} />
+ <Skeleton height={28} width={72} />
+ <Skeleton height={32} width={'100%'} />
</Flexbox>
)}
</Flexbox>
@@ -150,23 +150,23 @@ export const IntegrationDetailSkeleton = memo<{ withNestedContent?: boolean }>(
({ withNestedContent = false }) => (
<Flexbox gap={20}>
<Flexbox horizontal align="center" gap={12}>
- <Skeleton.Button active size={'small'} style={{ width: 20 }} />
- <Skeleton.Button active style={{ height: 28, width: 96 }} />
+ <Skeleton height={28} width={20} />
+ <Skeleton height={28} width={96} />
</Flexbox>
<Block className={styles.card}>
<Flexbox horizontal align="center" gap={16}>
- <Skeleton.Avatar active shape={'square'} size={48} />
+ <Skeleton.Avatar shape={'square'} size={48} />
<Flexbox flex={1} gap={6}>
- <Skeleton.Button active size={'small'} style={{ width: 64 }} />
- <Skeleton active paragraph={{ rows: 1, width: '65%' }} title={false} />
+ <Skeleton height={28} width={64} />
+ <Skeleton.Text rows={1} width={'65%'} />
</Flexbox>
- <Skeleton.Button active style={{ height: 40, width: 120 }} />
+ <Skeleton height={40} width={120} />
</Flexbox>
</Block>
<Flexbox gap={8}>
- <Skeleton.Button active size={'small'} style={{ width: 72 }} />
+ <Skeleton height={28} width={72} />
<ConnectionsSkeleton withNestedContent={withNestedContent} />
</Flexbox>
</Flexbox>
diff --git a/src/features/Messenger/index.tsx b/src/features/Messenger/index.tsx
index 366b427287f..ccf45675d2a 100644
--- a/src/features/Messenger/index.tsx
+++ b/src/features/Messenger/index.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
import { Button, Text, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo, useEffect, useState } from 'react';
@@ -145,8 +145,6 @@ const MessengerSettings = memo(() => {
error={platformsSWR.error}
errorVariant={'block'}
isEmpty={platforms.length === 0}
- isLoading={platformsSWR.isLoading}
- loading={<Skeleton active paragraph={{ rows: 3 }} title={false} />}
empty={
<div className={styles.emptyState}>{t('messenger.noPlatformsConfigured')}</div>
}
diff --git a/src/features/MobileHome/SkeletonList.tsx b/src/features/MobileHome/SkeletonList.tsx
index ab754d2fcd0..579eb4dc688 100644
--- a/src/features/MobileHome/SkeletonList.tsx
+++ b/src/features/MobileHome/SkeletonList.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo } from 'react';
@@ -51,17 +52,15 @@ const SkeletonList = memo<SkeletonListProps>(({ count = 4 }) => {
{Array.from({ length: count }).map((_, index) => (
<Flexbox horizontal align="center" className={styles.item} gap={12} key={index}>
<Skeleton.Avatar
- active
shape="square"
size={40}
style={{ borderRadius: cssVar.borderRadius, flex: 'none' }}
/>
<Flexbox flex={1} style={{ overflow: 'hidden' }}>
- <Skeleton
- active
- paragraph={{ className: styles.paragraph, rows: 1, width: '80%' }}
- title={{ className: styles.title, width: '60%' }}
- />
+ <Flexbox gap={16} width={'100%'}>
+ <Skeleton.Text className={styles.title} width={'60%'} />
+ <Skeleton.Text className={styles.paragraph} width={'80%'} />
+ </Flexbox>
</Flexbox>
</Flexbox>
))}
diff --git a/src/features/ModelSelect/index.tsx b/src/features/ModelSelect/index.tsx
index 7dbe533f61a..652c33355af 100644
--- a/src/features/ModelSelect/index.tsx
+++ b/src/features/ModelSelect/index.tsx
@@ -14,12 +14,6 @@ import { resolveEnableTargetProviderId, resolveStaleModelState } from './resolve
const prefixCls = 'ant';
-/**
- * Marks the popup-only part (explanatory hint) of the stale-model option so the
- * trigger can hide it, mirroring how ability tags are hidden via TAG_CLASSNAME.
- */
-const STALE_EXTRA_CLASSNAME = 'lobe-model-select-stale-extra';
-
/**
* Marks the stale-status Tag so the popup can hide it — inside the open list the
* status is conveyed by the enable toggle (notEnabled) or the remedy row
@@ -65,15 +59,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
`,
select: css`
/* The base-ui Select applies className to the trigger root while the popup is
- * portaled away, so scoping directly under this class hides the popup-only bits
- * (ability tags / stale hint) from the closed trigger without touching the list. */
+ * portaled away, so scoping directly under this class hides the popup-only
+ * ability tags from the closed trigger without touching the list. */
.${TAG_CLASSNAME} {
display: none;
}
-
- .${STALE_EXTRA_CLASSNAME} {
- display: none;
- }
`,
staleHint: css`
font-size: 12px;
@@ -273,63 +263,70 @@ const ModelSelect = memo<ModelSelectProps>(
const { meta, status } = staleState;
const successorName = staleState.successor?.displayName || staleState.successorId;
- const currentOption = {
- __stale: true,
- className: STALE_OPTION_CLASSNAME,
- disabled: true,
- label: (
- <Flexbox gap={4} style={{ width: '100%' }}>
- <Flexbox horizontal align={'center'} gap={8}>
- <ModelIcon model={value.model} size={20} />
- <Text ellipsis style={{ fontSize: 14 }}>
- {meta?.displayName || value.model}
- </Text>
- <Tooltip title={t(`ModelSelect.staleModel.${status}.tooltip`, { successorName })}>
- <Tag
- className={STALE_TAG_CLASSNAME}
- color={status === 'removed' ? 'warning' : undefined}
- size={'small'}
- style={{ cursor: 'default', flex: 'none' }}
+ // The trigger renders the selected option's `label`, so the enable Switch and
+ // the hint stay out of it: a <button> inside the trigger <button> is invalid
+ // HTML. They live on `popupLabel`, which only `optionRender` reads.
+ const renderStaleLabel = (withPopupExtras: boolean) => (
+ <Flexbox gap={4} style={{ width: '100%' }}>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <ModelIcon model={value.model} size={20} />
+ <Text ellipsis style={{ fontSize: 14 }}>
+ {meta?.displayName || value.model}
+ </Text>
+ <Tooltip title={t(`ModelSelect.staleModel.${status}.tooltip`, { successorName })}>
+ <Tag
+ className={STALE_TAG_CLASSNAME}
+ color={status === 'removed' ? 'warning' : undefined}
+ size={'small'}
+ style={{ cursor: 'default', flex: 'none' }}
+ >
+ {t(`ModelSelect.staleModel.${status}.tag`)}
+ </Tag>
+ </Tooltip>
+ {withPopupExtras && status === 'notEnabled' && (
+ <>
+ <span style={{ flex: 1 }} />
+ {/* The wrapper re-enables pointer events (the disabled option row
+ * suppresses them) and stops propagation so toggling never counts
+ * as selecting the row. */}
+ <span
+ style={{ flex: 'none', pointerEvents: 'auto' }}
+ onClick={(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ }}
+ onMouseDown={(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ }}
>
- {t(`ModelSelect.staleModel.${status}.tag`)}
- </Tag>
- </Tooltip>
- {status === 'notEnabled' && (
- <>
- <span className={STALE_EXTRA_CLASSNAME} style={{ flex: 1 }} />
- {/* The wrapper re-enables pointer events (the disabled option row
- * suppresses them) and stops propagation so toggling never counts
- * as selecting the row. */}
- <span
- className={STALE_EXTRA_CLASSNAME}
- style={{ flex: 'none', pointerEvents: 'auto' }}
- onClick={(e) => {
- e.stopPropagation();
- e.preventDefault();
- }}
- onMouseDown={(e) => {
- e.stopPropagation();
- e.preventDefault();
+ <Switch
+ aria-label={t('ModelSelect.staleModel.notEnabled.action')}
+ checked={false}
+ loading={enabling}
+ size={'small'}
+ onChange={() => {
+ void handleEnable();
}}
- >
- <Switch
- aria-label={t('ModelSelect.staleModel.notEnabled.action')}
- checked={false}
- loading={enabling}
- size={'small'}
- onChange={() => {
- void handleEnable();
- }}
- />
- </span>
- </>
- )}
- </Flexbox>
- <span className={`${STALE_EXTRA_CLASSNAME} ${styles.staleHint}`}>
+ />
+ </span>
+ </>
+ )}
+ </Flexbox>
+ {withPopupExtras && (
+ <span className={styles.staleHint}>
{t(`ModelSelect.staleModel.${status}.hint`, { successorName })}
</span>
- </Flexbox>
- ),
+ )}
+ </Flexbox>
+ );
+
+ const currentOption = {
+ __stale: true,
+ className: STALE_OPTION_CLASSNAME,
+ disabled: true,
+ label: renderStaleLabel(false),
+ popupLabel: renderStaleLabel(true),
value: `${value.provider}/${value.model}`,
};
@@ -383,7 +380,8 @@ const ModelSelect = memo<ModelSelectProps>(
value={value ? `${value.provider}/${value.model}` : null}
variant={variant}
optionRender={(option) => {
- if ((option as unknown as { __stale?: boolean }).__stale) return option.label;
+ const stale = option as unknown as { __stale?: boolean; popupLabel?: ReactNode };
+ if (stale.__stale) return stale.popupLabel ?? option.label;
return (
<ModelItemRender
diff --git a/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx b/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx
index 4e9ebf0f23c..7cc5cd736db 100644
--- a/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx
+++ b/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx
@@ -99,6 +99,25 @@ describe('MultipleProvidersModelItem', () => {
expect(screen.getByTestId('tooltip-ModelSelect.featureTag.audio')).toBeInTheDocument();
});
+ it('keeps spread model card fields off the DOM', async () => {
+ const { ModelItemRender } = await vi.importActual<typeof ModelSelectModule>(
+ '@/components/ModelSelect',
+ );
+ const modelCardProps = {
+ id: 'deepseek-v3',
+ knowledgeCutoff: '2025-01',
+ reasoning: true,
+ search: true,
+ structuredOutput: true,
+ };
+
+ const { container } = render(<ModelItemRender {...modelCardProps} />);
+
+ for (const attr of ['reasoning', 'search', 'structuredoutput', 'knowledgecutoff']) {
+ expect(container.querySelector(`[${attr}]`)).toBeNull();
+ }
+ });
+
it('renders model detail panel even when info tags are hidden', () => {
render(
<MultipleProvidersModelItem
diff --git a/src/features/PageEditor/DocumentComments/index.tsx b/src/features/PageEditor/DocumentComments/index.tsx
index a345d4b498b..6a16f9326c3 100644
--- a/src/features/PageEditor/DocumentComments/index.tsx
+++ b/src/features/PageEditor/DocumentComments/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Center, Flexbox, Skeleton } from '@lobehub/ui';
-import { Button, Text, toast } from '@lobehub/ui/base-ui';
+import { Center, Flexbox } from '@lobehub/ui';
+import { Button, Skeleton, Text, toast } from '@lobehub/ui/base-ui';
import { memo, useCallback, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
@@ -225,8 +225,8 @@ const DocumentComments = memo<{ documentId: string }>(({ documentId }) => {
<Flexbox horizontal align={'center'} className={styles.header} gap={8}>
{isHeaderLoading ? (
<>
- <Skeleton.Button active style={{ height: 28, width: 48 }} />
- <Skeleton.Button active style={{ height: 20, width: 16 }} />
+ <Skeleton height={28} width={48} />
+ <Skeleton height={20} width={16} />
</>
) : (
<>
diff --git a/src/features/PageEditor/TitleSection.tsx b/src/features/PageEditor/TitleSection.tsx
index 638ebbe188e..2b314da0f19 100644
--- a/src/features/PageEditor/TitleSection.tsx
+++ b/src/features/PageEditor/TitleSection.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Icon, Skeleton, TextArea } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, TextArea } from '@lobehub/ui';
+import { Button, Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { SmilePlus } from 'lucide-react';
import { memo, useState } from 'react';
@@ -114,7 +114,7 @@ const TitleSection = memo(() => {
{/* Title Input */}
{showTitleSkeleton ? (
- <Skeleton.Button active style={{ height: 44, width: 320 }} />
+ <Skeleton height={44} width={320} />
) : (
<TextArea
autoSize={{ minRows: 1 }}
diff --git a/src/features/Portal/Document/Header.tsx b/src/features/Portal/Document/Header.tsx
index 52bf0cb0672..9242a5b6c9d 100644
--- a/src/features/Portal/Document/Header.tsx
+++ b/src/features/Portal/Document/Header.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton, Text } from '@lobehub/ui/base-ui';
import { cx } from 'antd-style';
import { useClientDataSWR } from '@/libs/swr';
@@ -37,7 +37,7 @@ const Header = () => {
width={'100%'}
>
<Flexbox flex={1}>
- <Skeleton.Button active size={'small'} style={{ height: 16, width: 180 }} />
+ <Skeleton height={16} width={180} />
</Flexbox>
</Flexbox>
);
diff --git a/src/features/Portal/FilePreview/Title.tsx b/src/features/Portal/FilePreview/Title.tsx
index 2e1571c5c99..13d174bf515 100644
--- a/src/features/Portal/FilePreview/Title.tsx
+++ b/src/features/Portal/FilePreview/Title.tsx
@@ -1,5 +1,5 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { ActionIcon, Skeleton, Text } from '@lobehub/ui/base-ui';
import { ArrowLeft } from 'lucide-react';
import { useChatStore } from '@/store/chat';
@@ -22,7 +22,7 @@ const Title = () => {
<ActionIcon icon={ArrowLeft} size={'small'} onClick={() => closeFilePreview()} />
{isLoading ? (
- <Skeleton.Button active style={{ height: 28 }} />
+ <Skeleton height={28} />
) : (
<Text className={oneLineEllipsis} style={{ fontSize: 16 }} type={'secondary'}>
{data?.name}
diff --git a/src/features/Portal/Home/Body/Plugins/ArtifactList/index.tsx b/src/features/Portal/Home/Body/Plugins/ArtifactList/index.tsx
index 4f90348cb1a..a18254d8ea9 100644
--- a/src/features/Portal/Home/Body/Plugins/ArtifactList/index.tsx
+++ b/src/features/Portal/Home/Body/Plugins/ArtifactList/index.tsx
@@ -1,5 +1,5 @@
-import { Center, Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Avatar, Text } from '@lobehub/ui/base-ui';
+import { Center, Flexbox, Icon } from '@lobehub/ui';
+import { Avatar, Skeleton, Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { Origami } from 'lucide-react';
@@ -19,12 +19,7 @@ const ArtifactList = () => {
return !isCurrentChatLoaded ? (
<Flexbox gap={12} paddingInline={12}>
{[1, 1, 1, 1, 1, 1].map((key, index) => (
- <Skeleton.Button
- active
- block
- key={`${key}-${index}`}
- style={{ borderRadius: 8, height: 68 }}
- />
+ <Skeleton height={68} key={`${key}-${index}`} radius={8} />
))}
</Flexbox>
) : messages.length === 0 ? (
diff --git a/src/features/Portal/Thread/Header/Title.tsx b/src/features/Portal/Thread/Header/Title.tsx
index 4d596c17097..2d7405e0ea8 100644
--- a/src/features/Portal/Thread/Header/Title.tsx
+++ b/src/features/Portal/Thread/Header/Title.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { useChatStore } from '@/store/chat';
@@ -10,7 +10,7 @@ const Header = () => {
const isInit = useChatStore((s) => s.threadsInit);
- if (!isInit) return <Skeleton.Button active size={'small'} style={{ height: 22, width: 200 }} />;
+ if (!isInit) return <Skeleton height={22} width={200} />;
return isInNew ? <NewThread /> : <ActiveThread />;
};
diff --git a/src/features/Projects/Layout/index.tsx b/src/features/Projects/Layout/index.tsx
index 0108019ae8c..da891355167 100644
--- a/src/features/Projects/Layout/index.tsx
+++ b/src/features/Projects/Layout/index.tsx
@@ -3,7 +3,9 @@
import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import ProjectDisabled from '@/features/Projects/ProjectDisabled';
import { useUserStore } from '@/store/user';
import { labPreferSelectors } from '@/store/user/selectors';
@@ -19,7 +21,11 @@ const ProjectLayout = memo(() => {
<>
<ProjectSidebar />
<Flexbox flex={1} height="100%" style={{ minWidth: 0 }}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
</>
);
diff --git a/src/features/Projects/Workspace/ProjectDashboard.tsx b/src/features/Projects/Workspace/ProjectDashboard.tsx
index 887083a06a6..077c1e19f64 100644
--- a/src/features/Projects/Workspace/ProjectDashboard.tsx
+++ b/src/features/Projects/Workspace/ProjectDashboard.tsx
@@ -1,7 +1,7 @@
'use client';
import type { TaskStatus, WorkSummaryItem } from '@lobechat/types';
-import { Block, Center, Empty, Flexbox, Icon, Skeleton } from '@lobehub/ui';
+import { Block, Center, Empty, Flexbox, Icon } from '@lobehub/ui';
import { Button, Tag, Text } from '@lobehub/ui/base-ui';
import { Progress } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
@@ -19,6 +19,7 @@ import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import AsyncError from '@/components/AsyncError';
+import { ArticleSkeleton } from '@/components/Skeleton';
import NavItem from '@/features/NavPanel/components/NavItem';
import {
getProjectAcceptancePath,
@@ -174,7 +175,7 @@ const ProjectDashboard = memo<ProjectDashboardProps>(({ detail, projectId }) =>
onRetry={() => void goalSWR.mutate()}
/>
) : goalSWR.isLoading && goals.length === 0 ? (
- <Skeleton active paragraph={{ rows: 4 }} />
+ <ArticleSkeleton rows={4} />
) : goals.length === 0 ? (
<Block padding={24} variant={'outlined'}>
<Center gap={10}>
@@ -260,7 +261,7 @@ const ProjectDashboard = memo<ProjectDashboardProps>(({ detail, projectId }) =>
onRetry={() => void workSWR.mutate()}
/>
) : workSWR.isLoading ? (
- <Skeleton active paragraph={{ rows: 4 }} />
+ <ArticleSkeleton rows={4} />
) : works.length === 0 ? (
<Empty
description={t('overview.worksEmptyDescription')}
diff --git a/src/features/RecommendTaskTemplates/TaskTemplateCardSkeleton.tsx b/src/features/RecommendTaskTemplates/TaskTemplateCardSkeleton.tsx
index de90a54dfa8..605f5f92ee6 100644
--- a/src/features/RecommendTaskTemplates/TaskTemplateCardSkeleton.tsx
+++ b/src/features/RecommendTaskTemplates/TaskTemplateCardSkeleton.tsx
@@ -1,4 +1,5 @@
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import { cssVar, cx } from 'antd-style';
import { memo } from 'react';
@@ -25,12 +26,11 @@ export const TaskTemplateCardSkeleton = memo<TaskTemplateCardSkeletonProps>(
paddingBlock={6}
>
<Skeleton.Avatar
- active
shape={'square'}
size={RECOMMENDATION_ICON_SIZE.compact}
style={{ borderRadius: cssVar.borderRadius, flex: 'none' }}
/>
- <Skeleton.Button active style={{ height: 16, width: '70%' }} />
+ <Skeleton height={16} width={'70%'} />
</Flexbox>
);
@@ -51,7 +51,6 @@ export const TaskTemplateCardSkeleton = memo<TaskTemplateCardSkeletonProps>(
style={{ flex: 1, minWidth: 0, overflow: 'hidden' }}
>
<Skeleton.Avatar
- active
shape={'square'}
size={RECOMMENDATION_ICON_SIZE.regular}
style={{ borderRadius: cssVar.borderRadius, flex: 'none' }}
@@ -63,26 +62,21 @@ export const TaskTemplateCardSkeleton = memo<TaskTemplateCardSkeletonProps>(
gap={6}
style={{ minWidth: 0, overflow: 'hidden' }}
>
- <Skeleton.Button active style={{ height: 20, width: 180 }} />
- <Skeleton.Avatar active shape={'circle'} size={12} style={{ flex: 'none' }} />
+ <Skeleton height={20} width={180} />
+ <Skeleton.Avatar shape={'circle'} size={12} style={{ flex: 'none' }} />
</Flexbox>
</Flexbox>
- <Skeleton.Avatar active shape={'circle'} size={'small'} style={{ flex: 'none' }} />
+ <Skeleton.Avatar shape={'circle'} size={24} style={{ flex: 'none' }} />
</Flexbox>
<Divider dashed style={{ marginBlock: 0 }} />
- <Skeleton.Paragraph
- active
- fontSize={14}
- rows={descriptionRows}
- style={{ marginBottom: 0 }}
- />
+ <Skeleton.Text fontSize={14} rows={descriptionRows} style={{ marginBottom: 0 }} />
<Flexbox horizontal align={'center'} gap={8} justify={'space-between'} wrap={'wrap'}>
- <Skeleton.Button active style={{ height: 22, width: 72 }} />
- <Skeleton.Button active style={{ height: 32, width: 96 }} />
+ <Skeleton height={22} width={72} />
+ <Skeleton height={32} width={96} />
</Flexbox>
</Block>
);
diff --git a/src/features/ResourceHome/Layout/index.tsx b/src/features/ResourceHome/Layout/index.tsx
index a45b05f274c..873ad7f8706 100644
--- a/src/features/ResourceHome/Layout/index.tsx
+++ b/src/features/ResourceHome/Layout/index.tsx
@@ -3,6 +3,9 @@
import { Flexbox } from '@lobehub/ui';
import { type FC } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import Sidebar from './Sidebar';
import { styles } from './style';
@@ -12,7 +15,11 @@ const HomeLayout: FC = () => {
<>
<Sidebar />
<Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
</>
);
diff --git a/src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx b/src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx
index a834a52f01b..e9fc7aabc54 100644
--- a/src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx
+++ b/src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx
@@ -1,8 +1,8 @@
'use client';
-import { Block, Center, Skeleton, stopPropagation } from '@lobehub/ui';
+import { Block, Center, stopPropagation } from '@lobehub/ui';
import type { DropdownItem } from '@lobehub/ui/base-ui';
-import { ActionIcon, DropdownMenu, Text } from '@lobehub/ui/base-ui';
+import { ActionIcon, DropdownMenu, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { ChevronsUpDownIcon } from 'lucide-react';
import type { DragEvent } from 'react';
@@ -143,7 +143,7 @@ const Head = memo<{ id: string }>(({ id }) => {
/>
</Center>
{!name ? (
- <Skeleton active paragraph={false} title={{ style: { marginBottom: 0 }, width: 80 }} />
+ <Skeleton.Text width={80} />
) : (
<DropdownMenu items={menuItems} placement="bottomRight">
<Center
diff --git a/src/features/ResourceLibrary/Layout/index.tsx b/src/features/ResourceLibrary/Layout/index.tsx
index 2b531dcaa8a..57a6af993c5 100644
--- a/src/features/ResourceLibrary/Layout/index.tsx
+++ b/src/features/ResourceLibrary/Layout/index.tsx
@@ -5,8 +5,10 @@ import { Button } from '@lobehub/ui/base-ui';
import { type FC } from 'react';
import { useTranslation } from 'react-i18next';
import { Outlet, useParams } from 'react-router';
+import { SWRConfig } from 'swr';
import AsyncError from '@/components/AsyncError';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import RegisterHotkeys from '@/features/ResourceLibrary/RegisterHotkeys';
import { useKnowledgeBaseItem } from '@/features/ResourceManager/hooks/useKnowledgeItem';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
@@ -45,7 +47,11 @@ const LibraryLayout: FC = () => {
<>
<Sidebar />
<Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
<RegisterHotkeys />
</>
diff --git a/src/features/ResourceManager/Layout/index.tsx b/src/features/ResourceManager/Layout/index.tsx
index e169f43b1f2..b299b1bec7b 100644
--- a/src/features/ResourceManager/Layout/index.tsx
+++ b/src/features/ResourceManager/Layout/index.tsx
@@ -2,13 +2,20 @@
import { type FC } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import RegisterHotkeys from './RegisterHotkeys';
const ResourceLayout: FC = () => {
return (
<>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
<RegisterHotkeys />
</>
);
diff --git a/src/features/ResourceManager/components/ChunkDrawer/Loading/index.tsx b/src/features/ResourceManager/components/ChunkDrawer/Loading/index.tsx
index b8ea38d29b7..dd012d33a36 100644
--- a/src/features/ResourceManager/components/ChunkDrawer/Loading/index.tsx
+++ b/src/features/ResourceManager/components/ChunkDrawer/Loading/index.tsx
@@ -1,14 +1,15 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
const SkeletonLoading = memo(() => (
<Flexbox padding={12}>
- <Skeleton active paragraph={{ width: '70%' }} title={false} />
- <Skeleton active paragraph={{ width: '40%' }} title={false} />
- <Skeleton active paragraph={{ width: '80%' }} title={false} />
- <Skeleton active paragraph={{ width: '30%' }} title={false} />
- <Skeleton active paragraph={{ width: '50%' }} title={false} />
- <Skeleton active paragraph={{ width: '70%' }} title={false} />
+ <Skeleton.Text width={'70%'} />
+ <Skeleton.Text width={'40%'} />
+ <Skeleton.Text width={'80%'} />
+ <Skeleton.Text width={'30%'} />
+ <Skeleton.Text width={'50%'} />
+ <Skeleton.Text width={'70%'} />
</Flexbox>
));
diff --git a/src/features/ResourceManager/components/Editor/index.tsx b/src/features/ResourceManager/components/Editor/index.tsx
index 0a39c7a99e0..5a09d0d3c04 100644
--- a/src/features/ResourceManager/components/Editor/index.tsx
+++ b/src/features/ResourceManager/components/Editor/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { ActionIcon, createModal } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { ActionIcon, createModal, Skeleton } from '@lobehub/ui/base-ui';
import { cssVar, useTheme } from 'antd-style';
import { t as i18nT } from 'i18next';
import { ArrowLeftIcon, DownloadIcon, InfoIcon } from 'lucide-react';
@@ -23,12 +23,8 @@ interface FileEditorProps {
const FileDetailSkeleton = () => (
<Flexbox gap={16}>
- <Skeleton
- active
- paragraph={{ rows: 5, width: ['80%', '60%', '40%', '70%', '70%'] }}
- title={false}
- />
- <Skeleton active paragraph={{ rows: 2, width: ['50%', '60%'] }} title={false} />
+ <Skeleton.Text rows={5} width={['80%', '60%', '40%', '70%', '70%']} />
+ <Skeleton.Text rows={2} width={['50%', '60%']} />
</Flexbox>
);
diff --git a/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx b/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx
index 276b0019179..1736889a8c3 100644
--- a/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx
+++ b/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -117,7 +118,7 @@ const Breadcrumb = memo<BreadcrumbProps>(({ category, fileName }) => {
{knowledgeBaseName ? (
knowledgeBaseName
) : (
- <Skeleton.Button active size="small" style={{ height: 14, minWidth: 80, width: 80 }} />
+ <Skeleton style={{ height: 14, minWidth: 80, width: 80 }} />
)}
</span>
diff --git a/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx b/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx
index 84f56379722..bb25eee21dd 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx
+++ b/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx
@@ -1,5 +1,5 @@
-import { Center, Flexbox, Skeleton } from '@lobehub/ui';
-import { Checkbox } from '@lobehub/ui/base-ui';
+import { Center, Flexbox } from '@lobehub/ui';
+import { Checkbox, Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { FILE_DATE_WIDTH, FILE_SIZE_WIDTH, getListViewMinWidth } from './ListItem/constants';
@@ -53,11 +53,11 @@ const ListViewSkeleton = ({
width: columnWidths.name,
}}
>
- <Skeleton.Avatar active shape={'square'} size={24} style={{ marginInline: 8 }} />
- <Skeleton.Button active style={{ height: 16, width: '60%' }} />
+ <Skeleton.Avatar shape={'square'} size={24} style={{ marginInline: 8 }} />
+ <Skeleton height={16} width={'60%'} />
</Flexbox>
<Flexbox style={{ flexShrink: 0, paddingInline: '0 24px' }} width={columnWidths.date}>
- <Skeleton.Button active style={{ height: 16, width: '80%' }} />
+ <Skeleton height={16} width={'80%'} />
</Flexbox>
{showUploader && (
<Flexbox
@@ -67,12 +67,12 @@ const ListViewSkeleton = ({
style={{ flexShrink: 0, paddingInline: '0 24px' }}
width={columnWidths.uploader}
>
- <Skeleton.Avatar active size={20} />
- <Skeleton.Button active style={{ height: 16, width: '70%' }} />
+ <Skeleton.Avatar size={20} />
+ <Skeleton height={16} width={'70%'} />
</Flexbox>
)}
<Flexbox style={{ flexShrink: 0, paddingInline: '0 24px' }} width={columnWidths.size}>
- <Skeleton.Button active style={{ height: 16, width: '60%' }} />
+ <Skeleton height={16} width={'60%'} />
</Flexbox>
</Flexbox>
))}
diff --git a/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx b/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx
index 9380159d514..78ca1dc1336 100644
--- a/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx
+++ b/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
@@ -24,23 +25,14 @@ interface TreeSkeletonItemProps {
const TreeSkeletonItem = memo<TreeSkeletonItemProps>(({ opacity = 1 }) => {
return (
<Flexbox horizontal className={styles.container} style={{ opacity }}>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
flex: 'none',
height: 16,
width: 16,
}}
/>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 16,
- width: `${Math.floor(Math.random() * 30 + 40)}%`,
- }}
- />
+ <Skeleton height={16} width={`${Math.floor(Math.random() * 30 + 40)}%`} />
</Flexbox>
);
});
diff --git a/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx b/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx
index ea37bbbc201..ccd9c18c8eb 100644
--- a/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx
+++ b/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx
@@ -1,8 +1,16 @@
'use client';
import { MAX_RESOURCE_COLLABORATORS_PER_ADD } from '@lobechat/const';
-import { Empty, Flexbox, Icon, SearchBar, SkeletonAvatar, SkeletonTitle } from '@lobehub/ui';
-import { Avatar, Button, Text, toast, useModalContext } from '@lobehub/ui/base-ui';
+import { Empty, Flexbox, Icon, SearchBar } from '@lobehub/ui';
+import {
+ Avatar,
+ Button,
+ SkeletonAvatar,
+ SkeletonText,
+ Text,
+ toast,
+ useModalContext,
+} from '@lobehub/ui/base-ui';
import { useHover } from 'ahooks';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import { CheckIcon, SearchXIcon, UsersIcon } from 'lucide-react';
@@ -250,7 +258,7 @@ const AddCollaboratorsContent = memo<AddCollaboratorsContentProps>(
[0, 1, 2].map((key) => (
<Flexbox horizontal align={'center'} className={styles.row} gap={12} key={key}>
<SkeletonAvatar size={40} />
- <SkeletonTitle style={{ marginBottom: 0, width: 180 }} />
+ <SkeletonText style={{ marginBottom: 0, width: 180 }} />
</Flexbox>
))
) : filtered.length === 0 ? (
diff --git a/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx b/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx
index e7de927b666..fd484feec4d 100644
--- a/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx
+++ b/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, SkeletonAvatar, SkeletonTitle } from '@lobehub/ui';
-import { ActionIcon, Avatar, Tag, Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { ActionIcon, Avatar, SkeletonAvatar, SkeletonText, Tag, Text } from '@lobehub/ui/base-ui';
import { Popconfirm } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import { XIcon } from 'lucide-react';
@@ -56,7 +56,7 @@ const CollaboratorList = memo<CollaboratorListProps>(({ resourceId, resourceType
{[0, 1].map((key) => (
<Flexbox horizontal align={'center'} className={styles.row} gap={12} key={key}>
<SkeletonAvatar size={32} />
- <SkeletonTitle style={{ marginBottom: 0, width: 160 }} />
+ <SkeletonText style={{ marginBottom: 0, width: 160 }} />
</Flexbox>
))}
</Flexbox>
diff --git a/src/features/ResourceTransferRequest/TransferManifestList.tsx b/src/features/ResourceTransferRequest/TransferManifestList.tsx
index 6204a60c3a4..45c364b8a70 100644
--- a/src/features/ResourceTransferRequest/TransferManifestList.tsx
+++ b/src/features/ResourceTransferRequest/TransferManifestList.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Block, Flexbox, Icon, SkeletonParagraph } from '@lobehub/ui';
-import { Button, Text } from '@lobehub/ui/base-ui';
+import { Block, Flexbox, Icon } from '@lobehub/ui';
+import { Button, SkeletonText, Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import type { LucideIcon } from 'lucide-react';
import { PowerOff, RotateCcw, TriangleAlert, Unlink } from 'lucide-react';
@@ -115,14 +115,7 @@ const TransferManifestList = ({
if (loading || !manifest)
return loading ? (
<Flexbox aria-label={t('transferRequest.manifestLoading')} role="status" style={style}>
- <SkeletonParagraph
- active
- fontSize={12}
- gap={8}
- lineHeight={19}
- rows={2}
- width={['88%', '64%']}
- />
+ <SkeletonText fontSize={12} gap={8} rows={2} width={['88%', '64%']} />
</Flexbox>
) : null;
diff --git a/src/features/SelfLearning/Portrait/LessonPreview.tsx b/src/features/SelfLearning/Portrait/LessonPreview.tsx
index d0fab7c37d3..66c175b50c7 100644
--- a/src/features/SelfLearning/Portrait/LessonPreview.tsx
+++ b/src/features/SelfLearning/Portrait/LessonPreview.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, SkeletonParagraph } from '@lobehub/ui';
-import { Tag, Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { SkeletonText, Tag, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -129,7 +129,7 @@ const LessonPreview = memo<LessonPreviewProps>(({ code, layer, lessonId, lessonP
</Flexbox>
</Flexbox>
- {isLoading && !data && <SkeletonParagraph rows={3} />}
+ {isLoading && !data && <SkeletonText rows={3} />}
{/* Without this the card sits on "loading…" forever: SWR clears isLoading on failure. */}
{!!error && !data && (
diff --git a/src/features/SelfLearning/index.tsx b/src/features/SelfLearning/index.tsx
index 196630095bd..c564b19e8ba 100644
--- a/src/features/SelfLearning/index.tsx
+++ b/src/features/SelfLearning/index.tsx
@@ -11,7 +11,6 @@ import { Link, useParams } from 'react-router';
import urlJoin from 'url-join';
import AsyncBoundary from '@/components/AsyncBoundary';
-import Loading from '@/components/Loading/BrandTextLoading';
import AgentBreadcrumb from '@/features/AgentBreadcrumb';
import NavHeader from '@/features/NavHeader';
import WideScreenContainer from '@/features/WideScreenContainer';
@@ -62,7 +61,7 @@ const SelfLearning = memo(() => {
[first.data],
);
const warmup = useHistoryWarmup(activeAgentId ?? undefined, learnedTotal);
- const { data, error, isLoading, mutate } = useExpertiseOverview(
+ const { data, error, mutate } = useExpertiseOverview(
activeAgentId ?? undefined,
warmup.refreshInterval,
);
@@ -273,8 +272,6 @@ const SelfLearning = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={!error && allDomains.length === 0}
- isLoading={isLoading}
- loading={<Loading debugId="SelfLearning" />}
empty={
<Center height={'100%'} style={{ minHeight: '50vh' }} width={'100%'}>
<Empty
diff --git a/src/features/ServiceModel/ModelAssignmentsForm.tsx b/src/features/ServiceModel/ModelAssignmentsForm.tsx
index c5d43627ae1..419b7aa520e 100644
--- a/src/features/ServiceModel/ModelAssignmentsForm.tsx
+++ b/src/features/ServiceModel/ModelAssignmentsForm.tsx
@@ -1,8 +1,8 @@
'use client';
import type { FormGroupItemType, FormItemProps } from '@lobehub/ui';
-import { Flexbox, Form, InputNumber, Skeleton, TextArea, Tooltip } from '@lobehub/ui';
-import { Switch } from '@lobehub/ui/base-ui';
+import { Flexbox, Form, InputNumber, TextArea, Tooltip } from '@lobehub/ui';
+import { Skeleton, Switch } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { memo, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -104,7 +104,7 @@ const ModelAssignmentsForm = memo(() => {
onRetry={() => refreshUserState()}
/>
);
- return <Skeleton active paragraph={{ rows: 8 }} title={false} />;
+ return <Skeleton.Text rows={8} />;
}
const updateDefaultAgentModel = async ({
diff --git a/src/features/Settings/Layout/index.tsx b/src/features/Settings/Layout/index.tsx
index f330cbff7bb..30c5725fbee 100644
--- a/src/features/Settings/Layout/index.tsx
+++ b/src/features/Settings/Layout/index.tsx
@@ -3,8 +3,11 @@
import { Flexbox } from '@lobehub/ui';
import { type FC } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import SideBar from '@/features/Settings/Layout/SideBar';
+import { RouteSkeletonChromeProvider } from '@/spa/router/routeSkeletonChrome';
import SettingsContextProvider from './ContextProvider';
import { styles } from './style';
@@ -19,7 +22,13 @@ const Layout: FC = () => {
>
<SideBar />
<Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <RouteSkeletonChromeProvider>
+ <Outlet />
+ </RouteSkeletonChromeProvider>
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
</SettingsContextProvider>
);
diff --git a/src/features/Settings/advanced/index.tsx b/src/features/Settings/advanced/index.tsx
index 87cc6312b34..cdafa8b4a5b 100644
--- a/src/features/Settings/advanced/index.tsx
+++ b/src/features/Settings/advanced/index.tsx
@@ -2,8 +2,8 @@
import { isDesktop } from '@lobechat/const';
import { type FormGroupItemType, type FormItemProps } from '@lobehub/ui';
-import { Form, Icon, Skeleton } from '@lobehub/ui';
-import { Select, Switch } from '@lobehub/ui/base-ui';
+import { Form, Icon } from '@lobehub/ui';
+import { Select, Skeleton, Switch } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { Loader2Icon } from 'lucide-react';
@@ -83,7 +83,7 @@ const Page = memo(() => {
onRetry={() => refreshUserState()}
/>
);
- return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ return <Skeleton.Text rows={5} />;
}
const advancedGroup: FormGroupItemType = {
diff --git a/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
index e2d0b78bb8e..6f39cff380c 100644
--- a/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
+++ b/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
@@ -1,12 +1,13 @@
'use client';
-import { Flexbox, Form, FormGroup, highlighterThemes, mermaidThemes, Skeleton } from '@lobehub/ui';
+import { Flexbox, Form, FormGroup, highlighterThemes, mermaidThemes } from '@lobehub/ui';
import { Select, Switch, Tabs } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AutoSaveHint from '@/components/Editor/AutoSaveHint';
+import { SettingsSectionSkeleton } from '@/components/Skeleton';
import { FORM_STYLE } from '@/const/layoutTokens';
import { useSaveState } from '@/hooks/useSaveState';
import { useUserStore } from '@/store/user';
@@ -24,7 +25,7 @@ const ChatAppearance = memo(() => {
const { status: saveStatus, lastSavedAt, save, retry } = useSaveState();
const [savingKey, setSavingKey] = useState<string>();
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isUserStateInit) return <SettingsSectionSkeleton />;
const handleChange = (key: string, value: any) => {
setSavingKey(key);
diff --git a/src/features/Settings/common/features/Appearance/index.tsx b/src/features/Settings/common/features/Appearance/index.tsx
index 538f8c050eb..c8a260445e1 100644
--- a/src/features/Settings/common/features/Appearance/index.tsx
+++ b/src/features/Settings/common/features/Appearance/index.tsx
@@ -1,12 +1,13 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, Skeleton } from '@lobehub/ui';
+import { Form } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import AutoSaveHint from '@/components/Editor/AutoSaveHint';
+import { SettingsSectionSkeleton } from '@/components/Skeleton';
import { FORM_STYLE } from '@/const/layoutTokens';
import { SettingsSearchAnchor } from '@/features/SettingsSearch/anchor';
import { useSaveState } from '@/hooks/useSaveState';
@@ -22,7 +23,7 @@ const Appearance = memo(() => {
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
const { status: saveStatus, lastSavedAt, save, retry } = useSaveState();
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isUserStateInit) return <SettingsSectionSkeleton />;
const theme: FormGroupItemType = {
children: [
diff --git a/src/features/Settings/common/features/Common/Common.tsx b/src/features/Settings/common/features/Common/Common.tsx
index fbd826c243a..61c5acca3ce 100644
--- a/src/features/Settings/common/features/Common/Common.tsx
+++ b/src/features/Settings/common/features/Common/Common.tsx
@@ -1,8 +1,8 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Flexbox, Form, Icon, ImageSelect, Skeleton } from '@lobehub/ui';
-import { Select, Tabs } from '@lobehub/ui/base-ui';
+import { Flexbox, Form, Icon, ImageSelect } from '@lobehub/ui';
+import { Select, Skeleton, Tabs } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { Ban, Gauge, Monitor, Moon, Mouse, Sun, Waves } from 'lucide-react';
import { useTheme as useNextThemesTheme } from 'next-themes';
@@ -40,8 +40,7 @@ const Common = memo(() => {
switchLocale(value);
};
- if (!(isStatusInit && isUserStateInit))
- return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!(isStatusInit && isUserStateInit)) return <Skeleton.Text rows={5} />;
const themeFormGroup: FormGroupItemType = {
children: [
diff --git a/src/features/Settings/creds/features/ViewCredModal/Content.tsx b/src/features/Settings/creds/features/ViewCredModal/Content.tsx
index da7b74918f3..95e598f0a9f 100644
--- a/src/features/Settings/creds/features/ViewCredModal/Content.tsx
+++ b/src/features/Settings/creds/features/ViewCredModal/Content.tsx
@@ -4,12 +4,14 @@ import { type UserCredSummary } from '@lobechat/types';
import { CopyButton, Flexbox } from '@lobehub/ui';
import { Alert } from '@lobehub/ui/base-ui';
import { useQuery } from '@tanstack/react-query';
-import { Descriptions, Skeleton, Typography } from 'antd';
+import { Descriptions, Typography } from 'antd';
import { createStaticStyles, cx } from 'antd-style';
import { Eye, EyeOff } from 'lucide-react';
import { type FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
+
import { type CredsApi } from '../useCredsApi';
const { Text } = Typography;
@@ -152,7 +154,7 @@ const ViewCredModalContent: FC<ViewCredModalContentProps> = ({ cred, credsApi })
const valueEntries = Object.entries(values);
if (isLoading) {
- return <Skeleton active paragraph={{ rows: 3 }} />;
+ return <ArticleSkeleton rows={3} />;
}
if (error) {
diff --git a/src/features/Settings/hotkey/features/Conversation.tsx b/src/features/Settings/hotkey/features/Conversation.tsx
index 3ae78abf953..6e98b74b461 100644
--- a/src/features/Settings/hotkey/features/Conversation.tsx
+++ b/src/features/Settings/hotkey/features/Conversation.tsx
@@ -2,7 +2,8 @@
import { HotkeyGroupEnum } from '@lobechat/const/hotkeys';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, HotkeyInput, Skeleton } from '@lobehub/ui';
+import { Form, HotkeyInput } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,7 +27,7 @@ const HotkeySetting = memo(() => {
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
const { status: saveStatus, lastSavedAt, save, retry } = useSaveState();
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isUserStateInit) return <Skeleton.Text rows={5} />;
const clearHotkeyBinding = (id: HotkeyItem['id']) => {
if (!hotkey[id]) return;
diff --git a/src/features/Settings/hotkey/features/Desktop.tsx b/src/features/Settings/hotkey/features/Desktop.tsx
index 2de15139e8e..8ae76957835 100644
--- a/src/features/Settings/hotkey/features/Desktop.tsx
+++ b/src/features/Settings/hotkey/features/Desktop.tsx
@@ -1,8 +1,8 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, HotkeyInput, Icon, Skeleton } from '@lobehub/ui';
-import { toast } from '@lobehub/ui/base-ui';
+import { Form, HotkeyInput, Icon } from '@lobehub/ui';
+import { Skeleton, toast } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { Loader2Icon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -33,7 +33,7 @@ const HotkeySetting = memo(() => {
const [loading, setLoading] = useState(false);
- if (!isHotkeysInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isHotkeysInit) return <Skeleton.Text rows={5} />;
const updateHotkey = async (id: DesktopHotkeyItem['id'], value: string) => {
setLoading(true);
diff --git a/src/features/Settings/hotkey/features/Essential.tsx b/src/features/Settings/hotkey/features/Essential.tsx
index 649286ab3b5..6c8f646b367 100644
--- a/src/features/Settings/hotkey/features/Essential.tsx
+++ b/src/features/Settings/hotkey/features/Essential.tsx
@@ -2,7 +2,8 @@
import { HotkeyGroupEnum } from '@lobechat/const/hotkeys';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, HotkeyInput, Skeleton } from '@lobehub/ui';
+import { Form, HotkeyInput } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,7 +27,7 @@ const HotkeySetting = memo(() => {
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
const { status: saveStatus, lastSavedAt, save, retry } = useSaveState();
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isUserStateInit) return <Skeleton.Text rows={5} />;
const clearHotkeyBinding = (id: HotkeyItem['id']) => {
if (!hotkey[id]) return;
diff --git a/src/features/Settings/image/features/Image.tsx b/src/features/Settings/image/features/Image.tsx
index 3218bcd1e7b..bf6ee8e90b8 100644
--- a/src/features/Settings/image/features/Image.tsx
+++ b/src/features/Settings/image/features/Image.tsx
@@ -2,7 +2,8 @@
import { type UserImageConfig } from '@lobechat/types';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, Icon, Skeleton } from '@lobehub/ui';
+import { Form, Icon } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { Loader2Icon } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -25,7 +26,7 @@ const ImageSettings = memo(() => {
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
if (!isUserStateInit) {
- return <Skeleton active paragraph={{ rows: 1 }} title={false} />;
+ return <Skeleton.Text rows={1} />;
}
const items: FormGroupItemType[] = [
diff --git a/src/features/Settings/labs/index.tsx b/src/features/Settings/labs/index.tsx
index 9b8edbea82c..1b33777ca3a 100644
--- a/src/features/Settings/labs/index.tsx
+++ b/src/features/Settings/labs/index.tsx
@@ -2,8 +2,8 @@
import { isDesktop } from '@lobechat/const';
import { type FormGroupItemType, type FormItemProps } from '@lobehub/ui';
-import { Flexbox, Form, Skeleton, Tooltip } from '@lobehub/ui';
-import { Alert, Switch, Tag } from '@lobehub/ui/base-ui';
+import { Flexbox, Form, Tooltip } from '@lobehub/ui';
+import { Alert, Skeleton, Switch, Tag } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { FlaskConicalIcon } from 'lucide-react';
import { memo } from 'react';
@@ -63,7 +63,7 @@ const LabsForm = memo(() => {
onRetry={() => refreshUserState()}
/>
);
- return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ return <Skeleton.Text rows={5} />;
}
const checkedByFlag = Object.fromEntries(
diff --git a/src/features/Settings/memory/features/Memory.tsx b/src/features/Settings/memory/features/Memory.tsx
index a2ea2ba1773..67db99d53cb 100644
--- a/src/features/Settings/memory/features/Memory.tsx
+++ b/src/features/Settings/memory/features/Memory.tsx
@@ -2,8 +2,8 @@
import { type UserMemoryEffort } from '@lobechat/types';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, Skeleton, Tooltip } from '@lobehub/ui';
-import { Switch } from '@lobehub/ui/base-ui';
+import { Form, Tooltip } from '@lobehub/ui';
+import { Skeleton, Switch } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -27,7 +27,7 @@ const MemorySetting = memo(() => {
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
const { status: saveStatus, lastSavedAt, save, retry } = useSaveState();
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 3 }} title={false} />;
+ if (!isUserStateInit) return <Skeleton.Text rows={3} />;
const memorySettings: FormGroupItemType = {
children: [
diff --git a/src/features/Settings/oauth-apps/features/AppDetail/index.tsx b/src/features/Settings/oauth-apps/features/AppDetail/index.tsx
index 9dab70d1b00..59a227c8ee9 100644
--- a/src/features/Settings/oauth-apps/features/AppDetail/index.tsx
+++ b/src/features/Settings/oauth-apps/features/AppDetail/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Button, confirmModal, Switch, Tag, Text, toast } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Button, confirmModal, Skeleton, Switch, Tag, Text, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { ArrowLeftIcon, Trash2Icon } from 'lucide-react';
import { type FC, useEffect } from 'react';
@@ -110,9 +110,9 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {
if (!detail)
return (
<Flexbox gap={16}>
- <Skeleton active paragraph={{ rows: 1, width: 200 }} title={false} />
+ <Skeleton.Text rows={1} width={200} />
<div className={styles.card}>
- <Skeleton active paragraph={{ rows: 4 }} title={false} />
+ <Skeleton.Text rows={4} />
</div>
</Flexbox>
);
diff --git a/src/features/Settings/oauth-apps/features/OAuthApps.tsx b/src/features/Settings/oauth-apps/features/OAuthApps.tsx
index 91eee217c06..53993874ba4 100644
--- a/src/features/Settings/oauth-apps/features/OAuthApps.tsx
+++ b/src/features/Settings/oauth-apps/features/OAuthApps.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { type FC } from 'react';
import { useTranslation } from 'react-i18next';
@@ -59,8 +59,8 @@ const OAuthApps: FC<OAuthAppsProps> = ({ canEdit }) => {
if (isLoading)
return (
<Flexbox gap={12} padding={12}>
- <Skeleton paragraph={{ rows: 2 }} title={false} />
- <Skeleton paragraph={{ rows: 2 }} title={false} />
+ <Skeleton.Text rows={2} />
+ <Skeleton.Text rows={2} />
</Flexbox>
);
diff --git a/src/features/Settings/oauth-apps/index.tsx b/src/features/Settings/oauth-apps/index.tsx
index 45be1ac4f1b..5bab2e40d52 100644
--- a/src/features/Settings/oauth-apps/index.tsx
+++ b/src/features/Settings/oauth-apps/index.tsx
@@ -1,5 +1,4 @@
-import { Skeleton } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
+import { Button, Skeleton } from '@lobehub/ui/base-ui';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router';
@@ -55,7 +54,7 @@ const Page = () => {
labPreferSelectors.enableOAuthApps(s),
]);
- if (!isPreferenceInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isPreferenceInit) return <Skeleton.Text rows={5} />;
if (!enableOAuthApps) return <NotFound />;
return (
diff --git a/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx b/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx
index fa07238ee53..0bc7e9c1fe2 100644
--- a/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx
+++ b/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx
@@ -1,7 +1,7 @@
import { BRANDING_PROVIDER } from '@lobechat/business-const';
import { ProviderCombine, ProviderIcon } from '@lobehub/icons';
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { Avatar, Tag, Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { Avatar, Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import { cssVar, cx } from 'antd-style';
import { memo } from 'react';
@@ -40,7 +40,7 @@ const ProviderCard = memo<ProviderCardProps>(
gap={24}
padding={16}
>
- <Skeleton active />
+ <Skeleton />
</Flexbox>
);
diff --git a/src/features/Settings/provider/detail/bedrock/index.tsx b/src/features/Settings/provider/detail/bedrock/index.tsx
index 0a801e06b8e..f1792ff6cd9 100644
--- a/src/features/Settings/provider/detail/bedrock/index.tsx
+++ b/src/features/Settings/provider/detail/bedrock/index.tsx
@@ -79,7 +79,7 @@ const useBedrockCard = (): ProviderItem => {
if (!hasAuthShape) return;
setAuthMode(inferBedrockAuthMode(keyVaults));
- }, [isLoading, keyVaults?.accessKeyId, keyVaults?.apiKey, keyVaults?.secretAccessKey]);
+ }, [isLoading, keyVaults]);
const authModeOptions = useMemo<TabsItem[]>(
() => [
diff --git a/src/features/Settings/provider/detail/ollama/CheckError.tsx b/src/features/Settings/provider/detail/ollama/CheckError.tsx
index 27e448a8d77..eb482311261 100644
--- a/src/features/Settings/provider/detail/ollama/CheckError.tsx
+++ b/src/features/Settings/provider/detail/ollama/CheckError.tsx
@@ -1,12 +1,12 @@
import { type ChatMessageError } from '@lobechat/types';
-import { Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { type ReactNode } from 'react';
import dynamic from '@/libs/next/dynamic';
import Container from './Container';
-const loading = () => <Skeleton active style={{ width: 400 }} />;
+const loading = () => <Skeleton style={{ width: 400 }} />;
const OllamaSetupGuide = dynamic(() => import('@/features/OllamaSetupGuide'), {
loading,
diff --git a/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx b/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx
index 9dfb78c1483..5681e36711e 100644
--- a/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx
+++ b/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx
@@ -1,5 +1,5 @@
-import { DropdownMenu, Flexbox, Skeleton, Tooltip } from '@lobehub/ui';
-import { ActionIcon, Button, confirmModal, Text, toast } from '@lobehub/ui/base-ui';
+import { DropdownMenu, Flexbox, Tooltip } from '@lobehub/ui';
+import { ActionIcon, Button, confirmModal, Skeleton, Text, toast } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { CircleX, EllipsisVertical, LucideRefreshCcwDot, PlusIcon } from 'lucide-react';
import { memo, use, useEffect, useState } from 'react';
@@ -93,7 +93,7 @@ const ModelTitle = memo<ModelFetcherProps>(
)}
</Flexbox>
{isLoading ? (
- <Skeleton.Button active size={'small'} style={{ width: 120 }} />
+ <Skeleton height={28} width={120} />
) : isEmpty ? null : (
<Flexbox horizontal align={'center'} gap={8}>
{!mobile && (
diff --git a/src/features/Settings/provider/features/ModelList/SkeletonList.tsx b/src/features/Settings/provider/features/ModelList/SkeletonList.tsx
index 014990e7149..a113cc2e47c 100644
--- a/src/features/Settings/provider/features/ModelList/SkeletonList.tsx
+++ b/src/features/Settings/provider/features/ModelList/SkeletonList.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
@@ -41,40 +42,17 @@ export const Placeholder = memo(() => {
return (
<Flexbox horizontal className={styles.container}>
<Flexbox horizontal className={styles.leftContent}>
- <Skeleton.Avatar active shape="square" size={32} style={{ flex: 'none' }} />
+ <Skeleton.Avatar shape="square" size={32} style={{ flex: 'none' }} />
<Flexbox className={styles.textContent}>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 18,
- width: 160,
- }}
- />
+ <Skeleton height={18} width={160} />
<Flexbox horizontal gap={4}>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 16,
- width: 60,
- }}
- />
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 16,
- width: 40,
- }}
- />
+ <Skeleton height={16} width={60} />
+ <Skeleton height={16} width={40} />
</Flexbox>
</Flexbox>
</Flexbox>
<Flexbox horizontal className={styles.rightContent}>
- <Skeleton.Button
- active
- size={'small'}
+ <Skeleton
style={{
borderRadius: 12,
height: 22,
diff --git a/src/features/Settings/provider/features/ModelList/index.tsx b/src/features/Settings/provider/features/ModelList/index.tsx
index c0a659fb72c..f67e1284715 100644
--- a/src/features/Settings/provider/features/ModelList/index.tsx
+++ b/src/features/Settings/provider/features/ModelList/index.tsx
@@ -46,7 +46,7 @@ const Content = memo<ContentProps>(({ id }) => {
const allModels = useAiInfraStore(aiModelSelectors.filteredAiProviderModelList, isEqual);
- const { isLoading, error, mutate } = useFetchAiProviderModels(id);
+ const { error, mutate } = useFetchAiProviderModels(id);
// Count models by type (for all models, not just enabled)
const modelCounts = useMemo(() => {
@@ -128,8 +128,6 @@ const Content = memo<ContentProps>(({ id }) => {
const availableTabKeys = tabs.map((tab) => tab.key);
const currentActiveTab = availableTabKeys.includes(activeTab) ? activeTab : 'all';
- if (isLoading) return <SkeletonList />;
-
// Error before empty: a failed model-list fetch must not render as
// "no models yet" (EmptyModels) — surface the reason + Retry (ux Read §1.1).
if (error && isEmpty)
diff --git a/src/features/Settings/provider/features/ProviderConfig/EnableSwitch.tsx b/src/features/Settings/provider/features/ProviderConfig/EnableSwitch.tsx
index 95ba812b8fc..665fa8489d9 100644
--- a/src/features/Settings/provider/features/ProviderConfig/EnableSwitch.tsx
+++ b/src/features/Settings/provider/features/ProviderConfig/EnableSwitch.tsx
@@ -1,4 +1,5 @@
-import { Skeleton, Tooltip } from '@lobehub/ui';
+import { Tooltip } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { type FC } from 'react';
@@ -28,7 +29,7 @@ const Switch = ({ id, Component }: SwitchProps) => {
]);
const { allowed: canManageProvider, reason } = usePermission('manage_provider_key');
- if (isLoading) return <Skeleton.Button active className={styles.switchLoading} />;
+ if (isLoading) return <Skeleton className={styles.switchLoading} height={36} />;
// slot for cloud
if (Component) return <Component id={id} />;
diff --git a/src/features/Settings/provider/features/ProviderConfig/index.tsx b/src/features/Settings/provider/features/ProviderConfig/index.tsx
index 8c30d133a4e..d93e748959a 100644
--- a/src/features/Settings/provider/features/ProviderConfig/index.tsx
+++ b/src/features/Settings/provider/features/ProviderConfig/index.tsx
@@ -4,8 +4,8 @@ import { BRANDING_PROVIDER } from '@lobechat/business-const';
import { AES_GCM_URL, BASE_PROVIDER_DOC_URL, FORM_STYLE } from '@lobechat/const';
import { ProviderCombine, ProviderIcon } from '@lobehub/icons';
import { type FormGroupItemType, type FormItemProps } from '@lobehub/ui';
-import { Center, Flexbox, Form, Icon, Skeleton, stopPropagation, Tooltip } from '@lobehub/ui';
-import { Avatar, Switch } from '@lobehub/ui/base-ui';
+import { Center, Flexbox, Form, Icon, stopPropagation, Tooltip } from '@lobehub/ui';
+import { Avatar, Skeleton, Switch } from '@lobehub/ui/base-ui';
import { useDebounceFn } from 'ahooks';
import { Form as AntdForm } from 'antd';
import { createStaticStyles, cssVar, cx, responsive } from 'antd-style';
@@ -404,7 +404,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
endpointItem,
showResponsesApiSwitch
? {
- children: isLoading ? <Skeleton.Button active /> : <Switch loading={configUpdating} />,
+ children: isLoading ? <Skeleton height={36} /> : <Switch loading={configUpdating} />,
desc: t('providerModels.config.responsesApi.desc'),
label: t('providerModels.config.responsesApi.title'),
minWidth: undefined,
@@ -415,7 +415,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
showChecker
? {
children: isLoading ? (
- <Skeleton.Button active />
+ <Skeleton height={36} />
) : (
<Checker
checkErrorRender={checkErrorRender}
diff --git a/src/features/Settings/proxy/features/ProxyForm.tsx b/src/features/Settings/proxy/features/ProxyForm.tsx
index e062218b080..3d7ccd13c2f 100644
--- a/src/features/Settings/proxy/features/ProxyForm.tsx
+++ b/src/features/Settings/proxy/features/ProxyForm.tsx
@@ -2,8 +2,8 @@
import { type NetworkProxySettings } from '@lobechat/electron-client-ipc';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Flexbox, Form, Skeleton } from '@lobehub/ui';
-import { Button, RadioGroup, Switch, toast } from '@lobehub/ui/base-ui';
+import { Flexbox, Form } from '@lobehub/ui';
+import { Button, RadioGroup, Skeleton, Switch, toast } from '@lobehub/ui/base-ui';
import { Form as AntdForm, Input } from 'antd';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -206,7 +206,7 @@ const ProxyForm = () => {
}
}, [proxySettings, testUrl, form, t]);
- if (isLoading) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (isLoading) return <Skeleton.Text rows={5} />;
const enableProxyGroup: FormGroupItemType = {
children: [
diff --git a/src/features/Settings/skill/features/SkillDetail/index.tsx b/src/features/Settings/skill/features/SkillDetail/index.tsx
index 2251196c2b7..2a6d3f3df46 100644
--- a/src/features/Settings/skill/features/SkillDetail/index.tsx
+++ b/src/features/Settings/skill/features/SkillDetail/index.tsx
@@ -2,8 +2,8 @@
import { getLobehubSkillProviderById } from '@lobechat/const';
import { agentDisplayName } from '@lobechat/types';
-import { Markdown, Skeleton, Tooltip } from '@lobehub/ui';
-import { Avatar, Button, confirmModal, toast } from '@lobehub/ui/base-ui';
+import { Markdown, Tooltip } from '@lobehub/ui';
+import { Avatar, Button, confirmModal, Skeleton, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { Plus, SquareArrowOutUpRight, Trash2, Unplug, Wrench } from 'lucide-react';
@@ -386,7 +386,7 @@ const SkillDetail = memo<SkillDetailProps>(({ identifier, type, onDelete }) => {
<Suspense
fallback={
<div style={{ padding: 24 }}>
- <Skeleton active paragraph={{ rows: 6 }} title={false} />
+ <Skeleton.Text rows={6} />
</div>
}
>
@@ -480,7 +480,7 @@ const SkillDetail = memo<SkillDetailProps>(({ identifier, type, onDelete }) => {
if (syncing) {
return (
<div style={{ padding: 24 }}>
- <Skeleton active paragraph={{ rows: 6 }} title={false} />
+ <Skeleton.Text rows={6} />
</div>
);
}
diff --git a/src/features/Settings/stats/features/overview/ShareButton/ShareModal.tsx b/src/features/Settings/stats/features/overview/ShareButton/ShareModal.tsx
index 0e3716e9ce5..ad1e06c698e 100644
--- a/src/features/Settings/stats/features/overview/ShareButton/ShareModal.tsx
+++ b/src/features/Settings/stats/features/overview/ShareButton/ShareModal.tsx
@@ -1,8 +1,8 @@
'use client';
import { type FormItemProps, type FormModalProps } from '@lobehub/ui';
-import { FormModal, Skeleton } from '@lobehub/ui';
-import { Tabs } from '@lobehub/ui/base-ui';
+import { FormModal } from '@lobehub/ui';
+import { Skeleton, Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -11,17 +11,7 @@ import { ImageType, imageTypeOptions, useScreenshot } from '@/hooks/useScreensho
import dynamic from '@/libs/next/dynamic';
const Preview = dynamic(() => import('./Preview'), {
- loading: () => (
- <Skeleton.Button
- active
- block
- size={'large'}
- style={{
- height: 400,
- width: '100%',
- }}
- />
- ),
+ loading: () => <Skeleton height={400} width={'100%'} />,
});
const prefixCls = 'ant';
diff --git a/src/features/Settings/stats/features/overview/Welcome.tsx b/src/features/Settings/stats/features/overview/Welcome.tsx
index be0c84ca9ac..2b8f6c3a8c8 100644
--- a/src/features/Settings/stats/features/overview/Welcome.tsx
+++ b/src/features/Settings/stats/features/overview/Welcome.tsx
@@ -1,5 +1,6 @@
import { BRANDING_NAME } from '@lobechat/business-const';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { Clock3Icon, ClockArrowUp } from 'lucide-react';
import { memo } from 'react';
import { Trans, useTranslation } from 'react-i18next';
@@ -48,7 +49,7 @@ const Welcome = memo<{ mobile?: boolean }>(({ mobile }) => {
components={{
span:
isLoading || !data ? (
- <Skeleton.Button active style={{ height: 24, minWidth: 40, width: 40 }} />
+ <Skeleton height={24} style={{ minWidth: 40 }} width={40} />
) : (
<span style={{ fontWeight: 'bold' }} />
),
diff --git a/src/features/Settings/stats/features/overview/WorkspaceWelcome.tsx b/src/features/Settings/stats/features/overview/WorkspaceWelcome.tsx
index edb8b162895..7e225c5ef51 100644
--- a/src/features/Settings/stats/features/overview/WorkspaceWelcome.tsx
+++ b/src/features/Settings/stats/features/overview/WorkspaceWelcome.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import dayjs from 'dayjs';
import { Clock3Icon, UsersIcon } from 'lucide-react';
import { memo } from 'react';
@@ -23,7 +24,7 @@ const WorkspaceWelcome = memo<{ mobile?: boolean }>(({ mobile }) => {
const members = useWorkspaceMembers();
if (!workspace) {
- return <Skeleton.Button active style={{ height: 24, minWidth: 200, width: 200 }} />;
+ return <Skeleton height={24} style={{ minWidth: 200 }} width={200} />;
}
const days = Math.max(1, dayjs().diff(dayjs(workspace.createdAt), 'day'));
diff --git a/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx
index 44881ea3388..f32a4d61014 100644
--- a/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx
+++ b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx
@@ -1,7 +1,7 @@
import { CategoryBar, useThemeColorRange } from '@lobehub/charts';
import { ModelIcon, ProviderIcon } from '@lobehub/icons';
-import { Collapse, Flexbox, Skeleton } from '@lobehub/ui';
-import { Avatar, Tag } from '@lobehub/ui/base-ui';
+import { Collapse, Flexbox } from '@lobehub/ui';
+import { Avatar, Skeleton, Tag } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -140,7 +140,7 @@ const ModelTable = memo<UsageChartProps>(({ data, isLoading, groupBy, resolveUse
};
return isLoading ? (
- <Skeleton active paragraph={{ rows: 8 }} title={false} />
+ <Skeleton.Text rows={8} />
) : (
<Collapse
defaultActiveKey={formattedData.map((item) => item.id)}
diff --git a/src/features/Settings/stats/features/usage/UsageTrends.tsx b/src/features/Settings/stats/features/usage/UsageTrends.tsx
index 81c2425e1a5..b273219e5df 100644
--- a/src/features/Settings/stats/features/usage/UsageTrends.tsx
+++ b/src/features/Settings/stats/features/usage/UsageTrends.tsx
@@ -1,6 +1,5 @@
import { type BarChartProps } from '@lobehub/charts';
-import { Skeleton } from '@lobehub/ui';
-import { Tabs } from '@lobehub/ui/base-ui';
+import { Skeleton, Tabs } from '@lobehub/ui/base-ui';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -130,7 +129,7 @@ const UsageTrends = memo<UsageChartProps>(({ isLoading, data, groupBy, resolveUs
/>
}
>
- {isLoading ? <Skeleton.Block height={280} /> : charts}
+ {isLoading ? <Skeleton height={280} /> : charts}
</StatsFormGroup>
);
});
diff --git a/src/features/Settings/stats/features/visualization/HeatmapStats.tsx b/src/features/Settings/stats/features/visualization/HeatmapStats.tsx
index 9fc107d56b5..2d4da1c1c23 100644
--- a/src/features/Settings/stats/features/visualization/HeatmapStats.tsx
+++ b/src/features/Settings/stats/features/visualization/HeatmapStats.tsx
@@ -1,4 +1,5 @@
-import { Block, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import { cssVar } from 'antd-style';
import { Fragment, memo, useMemo } from 'react';
@@ -94,11 +95,7 @@ const HeatmapStats = memo(() => {
{index > 0 && <Divider style={{ height: 32, margin: 0 }} type={'vertical'} />}
<Flexbox align={'center'} flex={1} gap={4}>
<div style={{ fontSize: 20, fontWeight: 'bold' }}>
- {loading || item.loading ? (
- <Skeleton.Button active size={'small'} style={{ width: 56 }} />
- ) : (
- item.value
- )}
+ {loading || item.loading ? <Skeleton height={28} width={56} /> : item.value}
</div>
<div style={{ color: cssVar.colorTextDescription, fontSize: 12 }}>{item.label}</div>
</Flexbox>
diff --git a/src/features/Settings/stats/index.tsx b/src/features/Settings/stats/index.tsx
index 5e43e980259..4b528a43528 100644
--- a/src/features/Settings/stats/index.tsx
+++ b/src/features/Settings/stats/index.tsx
@@ -9,6 +9,7 @@ import dayjs from 'dayjs';
import { Brain, UserIcon } from 'lucide-react';
import { memo, type ReactNode, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { SWRConfig } from 'swr';
import AsyncBoundary from '@/components/AsyncBoundary';
import SettingHeader from '@/features/Settings/features/SettingHeader';
@@ -50,7 +51,7 @@ interface StatsSettingProps {
showSettingHeader?: boolean;
}
-const StatsSetting = memo<StatsSettingProps>(
+const StatsContent = memo<StatsSettingProps>(
({ mobile, headerNode, enableUserDimension, resolveUser, showSettingHeader = true }) => {
const { t, i18n } = useTranslation('auth');
dayjs.locale(i18n.language);
@@ -175,4 +176,19 @@ const StatsSetting = memo<StatsSettingProps>(
},
);
+/**
+ * Every metric on this page fetches independently and gates itself with its own
+ * `AsyncBoundary` + Retry — a failed token count must not take the healthy
+ * message count down with it, and `errorVariant='metric'` exists so a failure
+ * never reads as a confident zero. Route-wide `suspense` would turn all of that
+ * into dead code by throwing to the route boundary instead, so the page opts
+ * out. The opt-out has to sit *above* the hooks it covers, hence the wrapper
+ * rather than an `SWRConfig` inside `StatsContent`.
+ */
+const StatsSetting = memo<StatsSettingProps>((props) => (
+ <SWRConfig value={{ suspense: false }}>
+ <StatsContent {...props} />
+ </SWRConfig>
+));
+
export default StatsSetting;
diff --git a/src/features/Settings/storage/index.tsx b/src/features/Settings/storage/index.tsx
index c2be02582e5..b4a7f9d81a4 100644
--- a/src/features/Settings/storage/index.tsx
+++ b/src/features/Settings/storage/index.tsx
@@ -1,8 +1,9 @@
'use client';
-import { Flexbox, FormGroup, Skeleton } from '@lobehub/ui';
+import { Flexbox, FormGroup } from '@lobehub/ui';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useServerConfigStore } from '@/store/serverConfig';
import { useUserStore } from '@/store/user';
@@ -26,7 +27,7 @@ const Page = ({ showSettingHeader = true }: PageProps) => {
{showSettingHeader && <SettingHeader title={t('tab.storage')} />}
<Flexbox style={{ display: isLoading ? 'flex' : 'none' }}>
<FormGroup collapsible={false} title={t('storage.actions.title')} variant="filled">
- <Skeleton active paragraph={{ rows: 4 }} />
+ <ArticleSkeleton rows={4} />
</FormGroup>
</Flexbox>
<Flexbox style={{ display: isLoading ? 'none' : 'flex' }}>
diff --git a/src/features/Settings/tts/features/OpenAI.tsx b/src/features/Settings/tts/features/OpenAI.tsx
index 33ab9b1379c..2946972c94e 100644
--- a/src/features/Settings/tts/features/OpenAI.tsx
+++ b/src/features/Settings/tts/features/OpenAI.tsx
@@ -1,8 +1,8 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, Icon, Skeleton } from '@lobehub/ui';
-import { Select } from '@lobehub/ui/base-ui';
+import { Form, Icon } from '@lobehub/ui';
+import { Select, Skeleton } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { Loader2Icon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -25,7 +25,7 @@ const OpenAI = memo(() => {
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
const [loading, setLoading] = useState(false);
- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
+ if (!isUserStateInit) return <Skeleton.Text rows={5} />;
const openai: FormGroupItemType = {
children: [
diff --git a/src/features/ShareModal/Modal.tsx b/src/features/ShareModal/Modal.tsx
index 463e5e2a5ae..e11767381dd 100644
--- a/src/features/ShareModal/Modal.tsx
+++ b/src/features/ShareModal/Modal.tsx
@@ -1,13 +1,14 @@
'use client';
import { type ConversationContext } from '@lobechat/types';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
import { createModal, type ModalInstance, Tabs } from '@lobehub/ui/base-ui';
import { t } from 'i18next';
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AsyncError from '@/components/AsyncError';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { useIsMobile } from '@/hooks/useIsMobile';
import ShareDataProvider, { useShareData } from './ShareDataProvider';
@@ -91,7 +92,7 @@ const ShareModalContent = memo(() => {
/>
{isLoading && dbMessages.length === 0 ? (
<Flexbox gap={12} paddingBlock={8}>
- <Skeleton active paragraph={{ rows: 8 }} />
+ <ArticleSkeleton rows={8} />
</Flexbox>
) : rendererState.status === 'error' && rendererState.tab === tab ? (
<AsyncError error={rendererState.error} variant={'block'} onRetry={retryRenderer} />
@@ -99,7 +100,7 @@ const ShareModalContent = memo(() => {
rendererState.render({ mobile: isMobile })
) : (
<Flexbox gap={12} paddingBlock={8}>
- <Skeleton active paragraph={{ rows: 8 }} />
+ <ArticleSkeleton rows={8} />
</Flexbox>
)}
</Flexbox>
diff --git a/src/features/SharePopover/index.tsx b/src/features/SharePopover/index.tsx
index cd9f1dfedf8..6a3cae0cdb9 100644
--- a/src/features/SharePopover/index.tsx
+++ b/src/features/SharePopover/index.tsx
@@ -1,6 +1,6 @@
'use client';
-import { copyToClipboard, Flexbox, Popover, Skeleton, usePopoverContext } from '@lobehub/ui';
+import { copyToClipboard, Flexbox, Popover, usePopoverContext } from '@lobehub/ui';
import { Button, Checkbox, confirmModal, Select, Text, toast } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import {
@@ -17,6 +17,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import useSWR from 'swr';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { useAppOrigin } from '@/hooks/useAppOrigin';
import { useIsMobile } from '@/hooks/useIsMobile';
import { usePermission } from '@/hooks/usePermission';
@@ -239,7 +240,7 @@ const SharePopoverContent = memo<SharePopoverContentProps>(({ agentId, onOpenMod
return (
<Flexbox className={styles.container} gap={16}>
<Text strong>{t('share', { ns: 'common' })}</Text>
- <Skeleton active paragraph={{ rows: 2 }} />
+ <ArticleSkeleton rows={2} />
</Flexbox>
);
}
diff --git a/src/features/SkillStore/SkillDetail/Agents.tsx b/src/features/SkillStore/SkillDetail/Agents.tsx
index 79d691b99e6..94becf5f0e3 100644
--- a/src/features/SkillStore/SkillDetail/Agents.tsx
+++ b/src/features/SkillStore/SkillDetail/Agents.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Center, Grid, Icon, Skeleton } from '@lobehub/ui';
+import { Center, Grid, Icon } from '@lobehub/ui';
import { Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { InboxIcon, ServerCrash } from 'lucide-react';
@@ -8,6 +8,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { VirtuosoGrid } from 'react-virtuoso';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { useClientDataSWR } from '@/libs/swr';
import { discoverKeys } from '@/libs/swr/keys';
import { discoverService } from '@/services/discover';
@@ -69,12 +70,7 @@ const Agents = memo(() => {
return (
<Grid gap={12} rows={2} width={'100%'}>
{Array.from({ length: 4 }).map((_, index) => (
- <Skeleton
- active
- avatar={{ shape: 'square', size: 40 }}
- key={index}
- paragraph={{ rows: 1 }}
- />
+ <ArticleSkeleton avatar={40} key={index} rows={1} />
))}
</Grid>
);
diff --git a/src/features/SkillStore/SkillDetail/Schema.tsx b/src/features/SkillStore/SkillDetail/Schema.tsx
index 2556a3d6c40..5ccda5b9cd2 100644
--- a/src/features/SkillStore/SkillDetail/Schema.tsx
+++ b/src/features/SkillStore/SkillDetail/Schema.tsx
@@ -1,12 +1,13 @@
'use client';
import { type SkillItem } from '@lobechat/types';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
import { Tabs, Tag } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import ContentViewer from '@/features/AgentSkillDetail/ContentViewer';
import FileTree from '@/features/FileTree';
import { DetailProvider } from '@/features/MCPPluginDetail/DetailProvider';
@@ -37,7 +38,6 @@ const styles = createStaticStyles(({ css }) => ({
const Schema = memo(() => {
const { t } = useTranslation('discover');
- const { t: ts } = useTranslation('setting');
const { tools, toolsLoading, skillContent } = useDetailContext();
const [activeKey, setActiveKey] = useState<string[]>([]);
const [mode, setMode] = useState<ModeType>(ModeType.Docs);
@@ -52,7 +52,7 @@ const Schema = memo(() => {
if (toolsLoading) {
return (
<Flexbox gap={16}>
- <Skeleton active paragraph={{ rows: 4 }} />
+ <ArticleSkeleton rows={4} />
</Flexbox>
);
}
diff --git a/src/features/SkillStore/SkillDetail/SkillDetailInner.tsx b/src/features/SkillStore/SkillDetail/SkillDetailInner.tsx
index c4c16198e23..e2cf02bb888 100644
--- a/src/features/SkillStore/SkillDetail/SkillDetailInner.tsx
+++ b/src/features/SkillStore/SkillDetail/SkillDetailInner.tsx
@@ -1,8 +1,10 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
import { lazy, memo, Suspense, useState } from 'react';
+import { ArticleSkeleton } from '@/components/Skeleton';
+
import Agents from './Agents';
import Header from './Header';
import { type TabKey } from './Nav';
@@ -13,7 +15,7 @@ const Schema = lazy(() => import('./Schema'));
const TabSkeleton = () => (
<Flexbox gap={16}>
- <Skeleton active paragraph={{ rows: 4 }} />
+ <ArticleSkeleton rows={4} />
</Flexbox>
);
diff --git a/src/features/SkillStore/SkillList/Loading.tsx b/src/features/SkillStore/SkillList/Loading.tsx
index a7fa2d4202a..4113e90d07e 100644
--- a/src/features/SkillStore/SkillList/Loading.tsx
+++ b/src/features/SkillStore/SkillList/Loading.tsx
@@ -1,9 +1,10 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
const Loading = () => {
return (
<Flexbox padding={16}>
- <Skeleton active paragraph={{ rows: 8 }} title={false} />
+ <Skeleton.Text rows={8} />
</Flexbox>
);
};
diff --git a/src/features/SkillStore/SkillList/MarketSkills/MarketSkillDetail.tsx b/src/features/SkillStore/SkillList/MarketSkills/MarketSkillDetail.tsx
index 34f3afa2694..4de821c23c4 100644
--- a/src/features/SkillStore/SkillList/MarketSkills/MarketSkillDetail.tsx
+++ b/src/features/SkillStore/SkillList/MarketSkills/MarketSkillDetail.tsx
@@ -4,7 +4,6 @@ import { type SkillResourceTreeNode } from '@lobechat/types';
import { Github } from '@lobehub/icons';
import { Flexbox, Icon } from '@lobehub/ui';
import { ActionIcon, Avatar } from '@lobehub/ui/base-ui';
-import { Skeleton } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import { unzip } from 'fflate';
import { DotIcon, ExternalLinkIcon } from 'lucide-react';
@@ -12,6 +11,7 @@ import { memo, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import PublishedTime from '@/components/PublishedTime';
+import { ArticleSkeleton } from '@/components/Skeleton';
import ContentViewer from '@/features/AgentSkillDetail/ContentViewer';
import FileTree from '@/features/FileTree';
import { marketApiService } from '@/services/marketApi';
@@ -185,7 +185,7 @@ const MarketSkillDetail = memo<MarketSkillDetailProps>(({ identifier }) => {
}, [installedResourceTree, zipTree, data?.resources]);
if (isLoading || !data) {
- return <Skeleton active paragraph={{ rows: 8 }} style={{ padding: 16 }} />;
+ return <ArticleSkeleton rows={8} style={{ padding: 16 }} />;
}
const { name, icon, version, description, homepage, github } = data;
diff --git a/src/features/SuggestQuestions/Skeleton.tsx b/src/features/SuggestQuestions/Skeleton.tsx
index 4647a6011e5..a9ca1261dfb 100644
--- a/src/features/SuggestQuestions/Skeleton.tsx
+++ b/src/features/SuggestQuestions/Skeleton.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton as LobeSkeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton as LobeSkeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
interface SkeletonProps {
@@ -11,14 +12,7 @@ const Skeleton = memo<SkeletonProps>(({ count = 3 }) => {
return (
<Flexbox gap={8}>
{Array.from({ length: count }).map((_, index) => (
- <LobeSkeleton.Button
- active
- key={index}
- style={{
- height: 68,
- width: '100%',
- }}
- />
+ <LobeSkeleton height={68} key={index} />
))}
</Flexbox>
);
diff --git a/src/features/TopicDoctorModal/Content.tsx b/src/features/TopicDoctorModal/Content.tsx
index a3de3e200ce..467894c2d0a 100644
--- a/src/features/TopicDoctorModal/Content.tsx
+++ b/src/features/TopicDoctorModal/Content.tsx
@@ -2,8 +2,7 @@
import type { TopicIssue } from '@lobechat/conversation-flow';
import { Flexbox, Icon } from '@lobehub/ui';
-import { Button, Text, toast, useModalContext } from '@lobehub/ui/base-ui';
-import { Skeleton } from 'antd';
+import { Button, Skeleton, Text, toast, useModalContext } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { CircleAlert, CircleCheck, EyeOff, Stethoscope } from 'lucide-react';
import { memo, useState } from 'react';
@@ -37,7 +36,7 @@ const TopicDoctorContent = memo<TopicDoctorContentProps>(({ agentId, topicId })
messageService.diagnoseTopic({ agentId, topicId }),
);
- if (isLoading) return <Skeleton active paragraph={{ rows: 3 }} title={false} />;
+ if (isLoading) return <Skeleton.Text rows={3} />;
// Without this the check failing would leave the skeleton up forever: SWR clears `isLoading`
// but never produces `data`, so a `!data` skeleton has no way back.
diff --git a/src/features/User/UserPanel/PanelContentSkeleton.tsx b/src/features/User/UserPanel/PanelContentSkeleton.tsx
index 875a384b7aa..9c84b9c0ac9 100644
--- a/src/features/User/UserPanel/PanelContentSkeleton.tsx
+++ b/src/features/User/UserPanel/PanelContentSkeleton.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo } from 'react';
@@ -10,8 +11,7 @@ const PanelContentSkeleton = memo(() => {
{/* UserInfo + DataStatistics area */}
<Flexbox gap={8} style={{ padding: '12px 16px' }}>
<Flexbox horizontal align="center" gap={12}>
- <Skeleton.Button
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 40,
@@ -20,10 +20,7 @@ const PanelContentSkeleton = memo(() => {
}}
/>
<Flexbox flex={1} gap={4}>
- <Skeleton.Button
- active
- block
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 16,
@@ -31,10 +28,7 @@ const PanelContentSkeleton = memo(() => {
opacity: 0.6,
}}
/>
- <Skeleton.Button
- active
- block
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 12,
@@ -46,10 +40,8 @@ const PanelContentSkeleton = memo(() => {
</Flexbox>
<Flexbox horizontal gap={4}>
{[1, 2, 3].map((i) => (
- <Skeleton.Button
- active
+ <Skeleton
key={i}
- size="small"
style={{
borderRadius: cssVar.borderRadius,
flex: 1,
@@ -66,8 +58,7 @@ const PanelContentSkeleton = memo(() => {
<Flexbox gap={2} key={row} style={{ padding: '0 8px' }}>
{[1, 2].map((i) => (
<Flexbox horizontal align="center" gap={8} key={i} style={{ height: 36 }}>
- <Skeleton.Button
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 20,
@@ -75,10 +66,7 @@ const PanelContentSkeleton = memo(() => {
width: 20,
}}
/>
- <Skeleton.Button
- active
- block
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 14,
@@ -98,9 +86,7 @@ const PanelContentSkeleton = memo(() => {
justify="space-between"
style={{ padding: '6px 8px 6px 16px' }}
>
- <Skeleton.Button
- active
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 20,
@@ -108,8 +94,7 @@ const PanelContentSkeleton = memo(() => {
opacity: 0.4,
}}
/>
- <Skeleton.Button
- size="small"
+ <Skeleton
style={{
borderRadius: cssVar.borderRadius,
height: 28,
diff --git a/src/features/WorkGallery/index.tsx b/src/features/WorkGallery/index.tsx
index 5886de9efcf..6bb35b63921 100644
--- a/src/features/WorkGallery/index.tsx
+++ b/src/features/WorkGallery/index.tsx
@@ -1,13 +1,14 @@
'use client';
import type { WorkSummaryItem } from '@lobechat/types';
-import { Center, Empty, Flexbox, Skeleton } from '@lobehub/ui';
+import { Center, Empty, Flexbox } from '@lobehub/ui';
import { Avatar, Button } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import { PackageOpenIcon, TriangleAlertIcon } from 'lucide-react';
import { memo, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { useAgentDisplayMeta } from '@/features/AgentTasks/shared/useAgentDisplayMeta';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
import { formatWorkVersionCost } from '@/utils/workVersionCost';
@@ -171,7 +172,7 @@ const SkeletonCards = memo<{ count: number }>(({ count }) => (
<div className={styles.cardList}>
{Array.from({ length: count }).map((_, index) => (
<div className={styles.skeletonCard} key={index}>
- <Skeleton active paragraph={{ rows: 6 }} />
+ <ArticleSkeleton rows={6} />
</div>
))}
</div>
diff --git a/src/features/WorkspaceSetting/Layout.tsx b/src/features/WorkspaceSetting/Layout.tsx
index 7a671dca09b..c4fb100cc76 100644
--- a/src/features/WorkspaceSetting/Layout.tsx
+++ b/src/features/WorkspaceSetting/Layout.tsx
@@ -3,8 +3,11 @@
import { Text } from '@lobehub/ui/base-ui';
import { type FC, memo } from 'react';
import { Outlet, useMatch } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import NavHeader from '@/features/NavHeader';
+import { RouteSkeletonChromeProvider } from '@/spa/router/routeSkeletonChrome';
import { WorkspaceSettingsTabs } from '@/types/workspaceSettings';
import Container from './Container';
@@ -37,7 +40,13 @@ const WorkspaceSettingsLayout: FC = () => {
return (
<>
<SideBar />
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <RouteSkeletonChromeProvider>
+ <Outlet />
+ </RouteSkeletonChromeProvider>
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</>
);
};
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/SkeletonList.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/SkeletonList.tsx
index b839118500a..f4c053628de 100644
--- a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/SkeletonList.tsx
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/SkeletonList.tsx
@@ -1,23 +1,14 @@
'use client';
-import { Grid, Skeleton } from '@lobehub/ui';
+import { Grid } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
const SkeletonList = memo<{ count?: number }>(({ count = 6 }) => {
return (
<Grid gap={4} maxItemWidth={64} padding={6} rows={6} width={'100%'}>
{Array.from({ length: count }).map((_, index) => (
- <Skeleton.Button
- active
- block
- key={index}
- style={{
- aspectRatio: 1,
- borderRadius: 4,
- height: 'auto',
- minWidth: 0,
- }}
- />
+ <Skeleton height={'auto'} key={index} radius={4} style={{ aspectRatio: 1, minWidth: 0 }} />
))}
</Grid>
);
diff --git a/src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx b/src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx
index c589ccb6110..bddff615aaa 100644
--- a/src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx
+++ b/src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Block, Center, Flexbox, Grid, Skeleton } from '@lobehub/ui';
+import { Block, Center, Flexbox, Grid } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
import PromptInput from '@/routes/(main)/(create)/image/features/PromptInput';
@@ -16,20 +17,20 @@ const SkeletonList = memo<SkeletonListProps>(({ embedInput = true }) => {
<Block variant={'borderless'}>
<Flexbox gap={12}>
{/* Prompt text skeleton */}
- <Skeleton.Button active style={{ height: 20, width: '95%' }} />
+ <Skeleton height={20} width={'95%'} />
{/* Metadata skeleton */}
<Flexbox horizontal gap={12} style={{ width: '100%' }}>
- <Skeleton.Button active style={{ height: 16, width: 120 }} />
- <Skeleton.Button active style={{ height: 16, width: 80 }} />
- <Skeleton.Button active style={{ height: 16, width: 60 }} />
- <Skeleton.Button active style={{ height: 16, width: 70 }} />
+ <Skeleton height={16} width={120} />
+ <Skeleton height={16} width={80} />
+ <Skeleton height={16} width={60} />
+ <Skeleton height={16} width={70} />
</Flexbox>
{/* Image grid skeleton - 2x2 layout */}
<Grid maxItemWidth={200} rows={4} width={'100%'}>
{Array.from({ length: 4 }).map((_, imageIndex) => (
- <Skeleton.Button active key={imageIndex} style={{ height: 200, width: '100%' }} />
+ <Skeleton height={200} key={imageIndex} width={'100%'} />
))}
</Grid>
</Flexbox>
diff --git a/src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx b/src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx
index d840d420f20..14ef878c771 100644
--- a/src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx
+++ b/src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Block, Center, Flexbox, Skeleton } from '@lobehub/ui';
+import { Block, Center, Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
import PromptInput from '@/routes/(main)/(create)/video/features/PromptInput';
@@ -15,20 +16,20 @@ const SkeletonList = memo<SkeletonListProps>(({ embedInput = true }) => {
<Block variant={'borderless'}>
<Flexbox gap={12}>
{/* Prompt text skeleton */}
- <Skeleton.Button active style={{ height: 20, width: '95%' }} />
+ <Skeleton height={20} width={'95%'} />
{/* Metadata skeleton (model tag, resolution, aspect ratio) */}
<Flexbox horizontal gap={4} style={{ marginBottom: 10 }}>
- <Skeleton.Button active style={{ height: 22, width: 120 }} />
- <Skeleton.Button active style={{ height: 22, width: 80 }} />
- <Skeleton.Button active style={{ height: 22, width: 60 }} />
+ <Skeleton height={22} width={120} />
+ <Skeleton height={22} width={80} />
+ <Skeleton height={22} width={60} />
</Flexbox>
{/* Video player skeleton */}
- <Skeleton.Button active style={{ aspectRatio: '16/9', height: 'auto', width: '100%' }} />
+ <Skeleton height={'auto'} style={{ aspectRatio: '16/9' }} />
{/* Timestamp skeleton */}
- <Skeleton.Button active style={{ height: 14, width: 140 }} />
+ <Skeleton height={14} width={140} />
</Flexbox>
</Block>
<div style={{ flex: 1 }} />
diff --git a/src/routes/(main)/agent/docs/[docId]/index.tsx b/src/routes/(main)/agent/docs/[docId]/index.tsx
index 817220b74c9..b484fbc7fd4 100644
--- a/src/routes/(main)/agent/docs/[docId]/index.tsx
+++ b/src/routes/(main)/agent/docs/[docId]/index.tsx
@@ -1,9 +1,7 @@
'use client';
-import { Suspense } from 'react';
import { useParams } from 'react-router';
-import SurfaceSkeleton from '@/components/Skeleton/Surface';
import AgentDocumentPage from '@/features/AgentDocumentPage';
import { getIdFromIdentifier } from '@/utils/identifier';
@@ -11,12 +9,8 @@ const AgentDocumentRoute = () => {
const { docId } = useParams<{ docId: string }>();
const documentId = getIdFromIdentifier(docId ?? '', 'docs');
- return (
- <Suspense fallback={<SurfaceSkeleton variant={'editor'} />}>
- {/* key remounts the editor when switching between documents */}
- <AgentDocumentPage documentId={documentId} key={documentId} />
- </Suspense>
- );
+ // key remounts the editor when switching between documents
+ return <AgentDocumentPage documentId={documentId} key={documentId} />;
};
export default AgentDocumentRoute;
diff --git a/src/routes/(main)/agent/permission/index.tsx b/src/routes/(main)/agent/permission/index.tsx
index 8b1e6393726..6e93b3e072e 100644
--- a/src/routes/(main)/agent/permission/index.tsx
+++ b/src/routes/(main)/agent/permission/index.tsx
@@ -1,27 +1,23 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
import { useParams } from 'react-router';
-import SurfaceSkeleton from '@/components/Skeleton/Surface';
import AgentPermission from '@/features/AgentPermission';
import ResourceConfigAccessGate from '@/features/ResourcePermission/ResourceConfigAccessGate';
const AgentPermissionPage = memo(() => {
const { aid } = useParams<{ aid: string }>();
+ // Managing who can do what is a configuration action: a chat-only member gets the same redirect + reason toast as on Agent Profile.
return (
- <Suspense fallback={<SurfaceSkeleton variant={'form'} />}>
- {/* Managing who can do what is a configuration action: a chat-only member
- gets the same redirect + reason toast as on Agent Profile. */}
- <ResourceConfigAccessGate
- redirectPath={`/agent/${aid ?? ''}`}
- resourceId={aid}
- resourceType="agent"
- >
- <AgentPermission />
- </ResourceConfigAccessGate>
- </Suspense>
+ <ResourceConfigAccessGate
+ redirectPath={`/agent/${aid ?? ''}`}
+ resourceId={aid}
+ resourceType="agent"
+ >
+ <AgentPermission />
+ </ResourceConfigAccessGate>
);
});
diff --git a/src/routes/(main)/agent/self-learning/[domainId]/experience/[lessonId]/index.tsx b/src/routes/(main)/agent/self-learning/[domainId]/experience/[lessonId]/index.tsx
index 573fd42a6b0..bfc5121efea 100644
--- a/src/routes/(main)/agent/self-learning/[domainId]/experience/[lessonId]/index.tsx
+++ b/src/routes/(main)/agent/self-learning/[domainId]/experience/[lessonId]/index.tsx
@@ -1,14 +1,9 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
-import Loading from '@/components/Loading/BrandTextLoading';
import LessonDetail from '@/features/SelfLearning/LessonDetail';
-const AgentSelfLearningLessonPage = memo(() => (
- <Suspense fallback={<Loading debugId={'SelfLearningLesson'} />}>
- <LessonDetail />
- </Suspense>
-));
+const AgentSelfLearningLessonPage = memo(() => <LessonDetail />);
export default AgentSelfLearningLessonPage;
diff --git a/src/routes/(main)/agent/self-learning/[domainId]/experience/index.tsx b/src/routes/(main)/agent/self-learning/[domainId]/experience/index.tsx
index 1453af56bac..0d39a90f630 100644
--- a/src/routes/(main)/agent/self-learning/[domainId]/experience/index.tsx
+++ b/src/routes/(main)/agent/self-learning/[domainId]/experience/index.tsx
@@ -1,15 +1,10 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
-import Loading from '@/components/Loading/BrandTextLoading';
import ExperienceList from '@/features/SelfLearning/ExperienceList';
/** The complete lesson list of one direction — every habit, nothing folded. */
-const AgentSelfLearningExperiencePage = memo(() => (
- <Suspense fallback={<Loading debugId={'SelfLearningExperience'} />}>
- <ExperienceList />
- </Suspense>
-));
+const AgentSelfLearningExperiencePage = memo(() => <ExperienceList />);
export default AgentSelfLearningExperiencePage;
diff --git a/src/routes/(main)/agent/self-learning/[domainId]/index.tsx b/src/routes/(main)/agent/self-learning/[domainId]/index.tsx
index caea22b32fb..f5a3e95a301 100644
--- a/src/routes/(main)/agent/self-learning/[domainId]/index.tsx
+++ b/src/routes/(main)/agent/self-learning/[domainId]/index.tsx
@@ -1,15 +1,10 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
-import Loading from '@/components/Loading/BrandTextLoading';
import SelfLearning from '@/features/SelfLearning';
/** The domain page is the same growth portrait, scoped to one direction via :domainId. */
-const AgentSelfLearningDomainPage = memo(() => (
- <Suspense fallback={<Loading debugId="SelfLearningDomain" />}>
- <SelfLearning />
- </Suspense>
-));
+const AgentSelfLearningDomainPage = memo(() => <SelfLearning />);
export default AgentSelfLearningDomainPage;
diff --git a/src/routes/(main)/agent/self-learning/index.tsx b/src/routes/(main)/agent/self-learning/index.tsx
index 0ab4e2dc74e..40fee24cb12 100644
--- a/src/routes/(main)/agent/self-learning/index.tsx
+++ b/src/routes/(main)/agent/self-learning/index.tsx
@@ -1,14 +1,9 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
-import Loading from '@/components/Loading/BrandTextLoading';
import SelfLearning from '@/features/SelfLearning';
-const AgentSelfLearningPage = memo(() => (
- <Suspense fallback={<Loading debugId="SelfLearning" />}>
- <SelfLearning />
- </Suspense>
-));
+const AgentSelfLearningPage = memo(() => <SelfLearning />);
export default AgentSelfLearningPage;
diff --git a/src/routes/(main)/agent/self-learning/new/index.tsx b/src/routes/(main)/agent/self-learning/new/index.tsx
index 8cc409734dc..295f0bc7a0e 100644
--- a/src/routes/(main)/agent/self-learning/new/index.tsx
+++ b/src/routes/(main)/agent/self-learning/new/index.tsx
@@ -1,15 +1,10 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
-import Loading from '@/components/Loading/BrandTextLoading';
import CreateDomainPage from '@/features/SelfLearning/CreateDomainPage';
-const AgentSelfLearningCreatePage = memo(() => (
- <Suspense fallback={<Loading debugId="SelfLearningCreate" />}>
- <CreateDomainPage />
- </Suspense>
-));
+const AgentSelfLearningCreatePage = memo(() => <CreateDomainPage />);
AgentSelfLearningCreatePage.displayName = 'AgentSelfLearningCreatePage';
diff --git a/src/routes/(main)/agent/statistics/index.tsx b/src/routes/(main)/agent/statistics/index.tsx
index 08a86354d95..44180cc2edd 100644
--- a/src/routes/(main)/agent/statistics/index.tsx
+++ b/src/routes/(main)/agent/statistics/index.tsx
@@ -1,14 +1,7 @@
'use client';
-import { Suspense } from 'react';
-
-import SurfaceSkeleton from '@/components/Skeleton/Surface';
import AgentUsage from '@/features/AgentUsage';
-const AgentStatisticsPage = () => (
- <Suspense fallback={<SurfaceSkeleton variant={'grid'} />}>
- <AgentUsage />
- </Suspense>
-);
+const AgentStatisticsPage = () => <AgentUsage />;
export default AgentStatisticsPage;
diff --git a/src/routes/(main)/agent/topics/index.tsx b/src/routes/(main)/agent/topics/index.tsx
index fc347d65ca1..6ffb546c0d0 100644
--- a/src/routes/(main)/agent/topics/index.tsx
+++ b/src/routes/(main)/agent/topics/index.tsx
@@ -1,14 +1,7 @@
'use client';
-import { Suspense } from 'react';
-
-import TopicsSkeleton from '@/components/Skeleton/Topics';
import AgentTopicManager from '@/features/AgentTopicManager';
-const AgentTopicsPage = () => (
- <Suspense fallback={<TopicsSkeleton />}>
- <AgentTopicManager />
- </Suspense>
-);
+const AgentTopicsPage = () => <AgentTopicManager />;
export default AgentTopicsPage;
diff --git a/src/routes/(main)/community/(detail)/_layout/index.tsx b/src/routes/(main)/community/(detail)/_layout/index.tsx
index f5c36997cde..6d70c6c5466 100644
--- a/src/routes/(main)/community/(detail)/_layout/index.tsx
+++ b/src/routes/(main)/community/(detail)/_layout/index.tsx
@@ -3,9 +3,12 @@
import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import Footer from '@/features/Setting/Footer';
import WideScreenContainer from '@/features/WideScreenContainer';
+import { RouteSkeletonChromeProvider } from '@/spa/router/routeSkeletonChrome';
import { MAX_WIDTH, SCROLL_PARENT_ID } from '../../features/const';
import Header from './Header';
@@ -35,7 +38,13 @@ const DesktopDiscoverDetailLayout = memo(() => {
position: 'relative',
}}
>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <RouteSkeletonChromeProvider>
+ <Outlet />
+ </RouteSkeletonChromeProvider>
+ </SuspenseRouteBoundary>
+ </SWRConfig>
<div className={styles.spacer} />
<Footer />
</WideScreenContainer>
diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx
index 78be1ace741..76a4db3f4e7 100644
--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx
+++ b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx
@@ -7,8 +7,8 @@ import {
OFFICIAL_SITE,
} from '@lobechat/const';
import { type DiscoverPluginDetail, type PluginSource } from '@lobechat/types';
-import { Block, Flexbox, Icon, Image, Skeleton } from '@lobehub/ui';
-import { Avatar, Tag, Text } from '@lobehub/ui/base-ui';
+import { Block, Flexbox, Icon, Image } from '@lobehub/ui';
+import { Avatar, Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -198,7 +198,7 @@ const PluginItem = memo<PluginItemProps>(({ identifier }) => {
if (isLoading)
return (
<Block horizontal gap={12} key={identifier} padding={12} variant={'outlined'}>
- <Skeleton paragraph={{ rows: 1 }} title={false} />
+ <Skeleton.Text rows={1} />
</Block>
);
diff --git a/src/routes/(main)/community/(detail)/agent/index.tsx b/src/routes/(main)/community/(detail)/agent/index.tsx
index e41ddac3bec..7e446b129b8 100644
--- a/src/routes/(main)/community/(detail)/agent/index.tsx
+++ b/src/routes/(main)/community/(detail)/agent/index.tsx
@@ -14,7 +14,6 @@ import { DetailProvider } from './features/DetailProvider';
import Details from './features/Details';
import Header from './features/Header';
import StatusPage from './features/StatusPage';
-import Loading from './loading';
interface AssistantDetailPageProps {
mobile?: boolean;
@@ -26,9 +25,7 @@ const AssistantDetailPage = memo<AssistantDetailPageProps>(({ mobile }) => {
const { version, source } = useQuery() as { source?: AssistantMarketSource; version?: string };
const useAssistantDetail = useDiscoverStore((s) => s.useAssistantDetail);
- const { data, isLoading } = useAssistantDetail({ identifier, source, version });
-
- if (isLoading) return <Loading />;
+ const { data } = useAssistantDetail({ identifier, source, version });
if (!data) return <NotFound />;
// Check assistant status
diff --git a/src/routes/(main)/community/(detail)/agent/loading.tsx b/src/routes/(main)/community/(detail)/agent/loading.tsx
deleted file mode 100644
index a0dc59aa2a1..00000000000
--- a/src/routes/(main)/community/(detail)/agent/loading.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-'use client';
-
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { useResponsive } from 'antd-style';
-import { memo } from 'react';
-
-import Nav from './features/Details/Nav';
-
-const Loading = memo(() => {
- const { mobile } = useResponsive();
- return (
- <Flexbox gap={24}>
- <Flexbox gap={12}>
- <Flexbox horizontal align={'center'} gap={16} width={'100%'}>
- <Skeleton.Avatar active shape={'square'} size={mobile ? 48 : 64} />
- <Skeleton.Button active style={{ height: 36, width: 200 }} />
- </Flexbox>
- <Skeleton.Button size={'small'} style={{ width: 200 }} />
- </Flexbox>
- <Nav />
- <Flexbox
- gap={48}
- horizontal={!mobile}
- style={mobile ? { flexDirection: 'column-reverse' } : undefined}
- >
- <Flexbox
- flex={1}
- gap={16}
- width={'100%'}
- style={{
- overflow: 'hidden',
- }}
- >
- <Skeleton paragraph={{ rows: 3 }} title={false} />
- <Skeleton paragraph={{ rows: 8 }} title={false} />
- <Skeleton paragraph={{ rows: 8 }} title={false} />
- </Flexbox>
- <Flexbox gap={16} width={360}>
- <Skeleton paragraph={{ rows: 3 }} title={false} />
- <Skeleton paragraph={{ rows: 4 }} title={false} />
- </Flexbox>
- </Flexbox>
- </Flexbox>
- );
-});
-
-export default Loading;
diff --git a/src/routes/(main)/community/(detail)/features/ShareButton.tsx b/src/routes/(main)/community/(detail)/features/ShareButton.tsx
index fd68d5901ea..00be223f223 100644
--- a/src/routes/(main)/community/(detail)/features/ShareButton.tsx
+++ b/src/routes/(main)/community/(detail)/features/ShareButton.tsx
@@ -1,5 +1,5 @@
-import { Center, CopyButton, Flexbox, Icon, Input, Skeleton } from '@lobehub/ui';
-import { ActionIcon, Avatar, Button, Tag, Text } from '@lobehub/ui/base-ui';
+import { Center, CopyButton, Flexbox, Icon, Input } from '@lobehub/ui';
+import { ActionIcon, Avatar, Button, Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { startCase } from 'es-toolkit/compat';
import { LinkIcon, Share2Icon } from 'lucide-react';
@@ -134,7 +134,7 @@ const ShareButton = memo<ShareButtonProps>(({ meta, ...rest }) => {
</Center>
);
} else {
- content = <Skeleton active paragraph={{ rows: 4 }} title={false} />;
+ content = <Skeleton.Text rows={4} />;
}
return (
diff --git a/src/routes/(main)/community/(detail)/group_agent/index.tsx b/src/routes/(main)/community/(detail)/group_agent/index.tsx
index 76ef1cd7c27..5a8fca5429e 100644
--- a/src/routes/(main)/community/(detail)/group_agent/index.tsx
+++ b/src/routes/(main)/community/(detail)/group_agent/index.tsx
@@ -13,7 +13,6 @@ import { DetailProvider } from './features/DetailProvider';
import Details from './features/Details';
import Header from './features/Header';
import StatusPage from './features/StatusPage';
-import Loading from './loading';
interface GroupAgentDetailPageProps {
mobile?: boolean;
@@ -26,9 +25,7 @@ const GroupAgentDetailPage = memo<GroupAgentDetailPageProps>(({ mobile }) => {
// Fetch group agent detail
const useGroupAgentDetail = useDiscoverStore((s) => s.useGroupAgentDetail);
- const { data, isLoading } = useGroupAgentDetail({ identifier, version });
-
- if (isLoading) return <Loading />;
+ const { data } = useGroupAgentDetail({ identifier, version });
if (!data) return <NotFound />;
@@ -76,8 +73,7 @@ const GroupAgentDetailPage = memo<GroupAgentDetailPageProps>(({ mobile }) => {
locale: (data as any)?.locale,
memberAgents: (data as any)?.memberAgents || [],
ownerType: ((data as any)?.author?.type === 'organization' ? 'organization' : 'user') as
- | 'organization'
- | 'user',
+ 'organization' | 'user',
status: (data as any)?.group?.status,
summary: (data as any)?.summary,
tags: (data as any)?.currentVersion?.tags,
diff --git a/src/routes/(main)/community/(detail)/group_agent/loading.tsx b/src/routes/(main)/community/(detail)/group_agent/loading.tsx
deleted file mode 100644
index 3da3304eca6..00000000000
--- a/src/routes/(main)/community/(detail)/group_agent/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DetailsLoading as default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(detail)/mcp/index.tsx b/src/routes/(main)/community/(detail)/mcp/index.tsx
index d9d0289eb13..7ab0c2e5948 100644
--- a/src/routes/(main)/community/(detail)/mcp/index.tsx
+++ b/src/routes/(main)/community/(detail)/mcp/index.tsx
@@ -13,7 +13,6 @@ import { useDiscoverStore } from '@/store/discover';
import NotFound from '../components/NotFound';
import { TocProvider } from '../features/Toc/useToc';
import Details from './features/Details';
-import Loading from './loading';
interface McpDetailPageProps {
mobile?: boolean;
@@ -25,11 +24,9 @@ const McpDetailPage = memo<McpDetailPageProps>(({ mobile }) => {
const { version } = useQuery() as { version?: string };
const useMcpDetail = useDiscoverStore((s) => s.useFetchMcpDetail);
- const { data, isLoading } = useMcpDetail({ identifier, version });
+ const { data } = useMcpDetail({ identifier, version });
useFetchInstalledPlugins();
-
- if (isLoading) return <Loading />;
if (!data) return <NotFound />;
return (
diff --git a/src/routes/(main)/community/(detail)/mcp/loading.tsx b/src/routes/(main)/community/(detail)/mcp/loading.tsx
deleted file mode 100644
index 3da3304eca6..00000000000
--- a/src/routes/(main)/community/(detail)/mcp/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DetailsLoading as default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(detail)/model/index.tsx b/src/routes/(main)/community/(detail)/model/index.tsx
index 59996108506..83e1ddec806 100644
--- a/src/routes/(main)/community/(detail)/model/index.tsx
+++ b/src/routes/(main)/community/(detail)/model/index.tsx
@@ -10,7 +10,6 @@ import NotFound from '../components/NotFound';
import { DetailProvider } from './features/DetailProvider';
import Details from './features/Details';
import Header from './features/Header';
-import Loading from './loading';
interface ModelDetailPageProps {
mobile?: boolean;
@@ -21,9 +20,7 @@ const ModelDetailPage = memo<ModelDetailPageProps>(({ mobile }) => {
const identifier = decodeURIComponent(params.slug ?? '');
const useModelDetail = useDiscoverStore((s) => s.useModelDetail);
- const { data, isLoading } = useModelDetail({ identifier });
-
- if (isLoading) return <Loading />;
+ const { data } = useModelDetail({ identifier });
if (!data) return <NotFound />;
return (
diff --git a/src/routes/(main)/community/(detail)/model/loading.tsx b/src/routes/(main)/community/(detail)/model/loading.tsx
deleted file mode 100644
index 3da3304eca6..00000000000
--- a/src/routes/(main)/community/(detail)/model/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DetailsLoading as default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(detail)/organization/index.tsx b/src/routes/(main)/community/(detail)/organization/index.tsx
index 83ffbe64e9c..d9b850e051f 100644
--- a/src/routes/(main)/community/(detail)/organization/index.tsx
+++ b/src/routes/(main)/community/(detail)/organization/index.tsx
@@ -12,7 +12,6 @@ import { resolveWorkspaceCommunityProfileRedirect } from '../workspace/features/
import { OrganizationDetailProvider } from './features/DetailProvider';
import OrganizationHeader from './features/Header';
import OrganizationContent from './features/OrganizationContent';
-import Loading from './loading';
interface OrganizationDetailPageProps {
mobile?: boolean;
@@ -26,7 +25,7 @@ const OrganizationDetailPage = memo<OrganizationDetailPageProps>(({ mobile }) =>
const { isWorkspaceScope } = useCommunityWorkspaceProfile();
const useUserProfile = useDiscoverStore((s) => s.useUserProfile);
- const { data, isLoading } = useUserProfile({ username });
+ const { data } = useUserProfile({ username });
useEffect(() => {
const redirectTo = resolveWorkspaceCommunityProfileRedirect({
@@ -54,8 +53,6 @@ const OrganizationDetailPage = memo<OrganizationDetailPageProps>(({ mobile }) =>
user,
};
}, [data, mobile]);
-
- if (isLoading) return <Loading />;
if (!contextConfig) return <NotFound />;
return (
diff --git a/src/routes/(main)/community/(detail)/organization/loading.tsx b/src/routes/(main)/community/(detail)/organization/loading.tsx
deleted file mode 100644
index 5b2f4509ff9..00000000000
--- a/src/routes/(main)/community/(detail)/organization/loading.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-'use client';
-
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { memo } from 'react';
-
-import ListLoading from '@/routes/(main)/community/components/ListLoading';
-
-import Banner from './features/Header/Banner';
-
-const Loading = memo(() => {
- return (
- <Flexbox gap={24} width={'100%'}>
- <Banner />
- <Flexbox gap={16}>
- <Skeleton.Avatar
- shape={'square'}
- size={64}
- style={{ boxShadow: `0 0 0 4px ${cssVar.colorBgContainer}`, flexShrink: 0 }}
- />
- <Skeleton paragraph={{ rows: 1 }} />
- </Flexbox>
-
- <ListLoading length={4} rows={4} />
- </Flexbox>
- );
-});
-
-export default Loading;
diff --git a/src/routes/(main)/community/(detail)/provider/index.tsx b/src/routes/(main)/community/(detail)/provider/index.tsx
index 739607e34ab..3fdb6066e70 100644
--- a/src/routes/(main)/community/(detail)/provider/index.tsx
+++ b/src/routes/(main)/community/(detail)/provider/index.tsx
@@ -10,7 +10,6 @@ import NotFound from '../components/NotFound';
import { DetailProvider } from './features/DetailProvider';
import Details from './features/Details';
import Header from './features/Header';
-import Loading from './loading';
interface ProviderDetailPageProps {
mobile?: boolean;
@@ -21,9 +20,7 @@ const ProviderDetailPage = memo<ProviderDetailPageProps>(({ mobile }) => {
const identifier = decodeURIComponent(params.slug ?? '');
const useProviderDetail = useDiscoverStore((s) => s.useProviderDetail);
- const { data, isLoading } = useProviderDetail({ identifier, withReadme: true });
-
- if (isLoading) return <Loading />;
+ const { data } = useProviderDetail({ identifier, withReadme: true });
if (!data) return <NotFound />;
return (
diff --git a/src/routes/(main)/community/(detail)/provider/loading.tsx b/src/routes/(main)/community/(detail)/provider/loading.tsx
deleted file mode 100644
index 3da3304eca6..00000000000
--- a/src/routes/(main)/community/(detail)/provider/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DetailsLoading as default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(detail)/skill/index.tsx b/src/routes/(main)/community/(detail)/skill/index.tsx
index b59d3707bcb..e82223f84bc 100644
--- a/src/routes/(main)/community/(detail)/skill/index.tsx
+++ b/src/routes/(main)/community/(detail)/skill/index.tsx
@@ -5,7 +5,6 @@ import { memo, useCallback } from 'react';
import { useParams, useSearchParams } from 'react-router';
import { SkillDetailView, SkillNavKey } from '@/features/CommunitySkillDetail';
-import Loading from '@/features/CommunitySkillDetail/Loading';
import { useQuery } from '@/hooks/useQuery';
import { useDiscoverStore } from '@/store/discover';
@@ -49,9 +48,7 @@ const SkillDetailPage = memo<SkillDetailPageProps>(({ mobile }) => {
);
const useSkillDetail = useDiscoverStore((s) => s.useFetchSkillDetail);
- const { data, isLoading } = useSkillDetail({ identifier, version });
-
- if (isLoading) return <Loading />;
+ const { data } = useSkillDetail({ identifier, version });
if (!data) return <NotFound />;
return (
diff --git a/src/routes/(main)/community/(detail)/user/index.tsx b/src/routes/(main)/community/(detail)/user/index.tsx
index 6dc5993735a..f8942510479 100644
--- a/src/routes/(main)/community/(detail)/user/index.tsx
+++ b/src/routes/(main)/community/(detail)/user/index.tsx
@@ -15,7 +15,6 @@ import { UserDetailProvider } from './features/DetailProvider';
import UserHeader from './features/Header';
import UserContent from './features/UserContent';
import { useUserDetail } from './features/useUserDetail';
-import Loading from './loading';
interface UserDetailPageProps {
mobile?: boolean;
@@ -32,7 +31,7 @@ const UserDetailPage = memo<UserDetailPageProps>(({ mobile }) => {
useMarketAuth();
const useUserProfile = useDiscoverStore((s) => s.useUserProfile);
- const { data, isLoading, mutate } = useUserProfile({ username });
+ const { data, mutate } = useUserProfile({ username });
// When inside a workspace scope, /community/user/:slug and /community/org/:slug are not the
// right surface — redirect to the dedicated workspace community page.
@@ -119,8 +118,6 @@ const UserDetailPage = memo<UserDetailPageProps>(({ mobile }) => {
user,
};
}, [data, handleEditProfile, handleStatusChange, isOwner, mobile]);
-
- if (isLoading) return <Loading />;
if (!contextConfig) return <NotFound />;
return (
diff --git a/src/routes/(main)/community/(detail)/user/loading.tsx b/src/routes/(main)/community/(detail)/user/loading.tsx
deleted file mode 100644
index 82c3447e0cd..00000000000
--- a/src/routes/(main)/community/(detail)/user/loading.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-'use client';
-
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { memo } from 'react';
-
-import ListLoading from '@/routes/(main)/community/components/ListLoading';
-
-import Banner from './features/Header/Banner';
-
-const Loading = memo(() => {
- return (
- <Flexbox gap={24} width={'100%'}>
- {/* User Header Skeleton */}
- <Banner />
- <Flexbox gap={16}>
- <Skeleton.Avatar
- shape={'square'}
- size={64}
- style={{ boxShadow: `0 0 0 4px ${cssVar.colorBgContainer}`, flexShrink: 0 }}
- />
- <Skeleton paragraph={{ rows: 1 }} />
- </Flexbox>
-
- {/* Agent List Skeleton */}
- <ListLoading length={4} rows={4} />
- </Flexbox>
- );
-});
-
-export default Loading;
diff --git a/src/routes/(main)/community/(detail)/workspace/features/Header/index.tsx b/src/routes/(main)/community/(detail)/workspace/features/Header/index.tsx
index 14099c4b7d4..07c9a224e3f 100644
--- a/src/routes/(main)/community/(detail)/workspace/features/Header/index.tsx
+++ b/src/routes/(main)/community/(detail)/workspace/features/Header/index.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Skeleton, Tooltip, TooltipGroup } from '@lobehub/ui';
-import { ActionIcon, Avatar, Button, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Tooltip, TooltipGroup } from '@lobehub/ui';
+import { ActionIcon, Avatar, Button, Skeleton, Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { ExternalLink, Globe, Settings } from 'lucide-react';
import { memo, useCallback, useMemo } from 'react';
@@ -58,7 +58,7 @@ const WorkspaceHeader = memo(() => {
)}
</Flexbox>
{isLoading ? (
- <Skeleton.Button active style={{ height: 32, width: 140 }} />
+ <Skeleton height={32} width={140} />
) : (
<Flexbox horizontal gap={8}>
{publicProfileUrl && (
diff --git a/src/routes/(main)/community/(detail)/workspace/loading.tsx b/src/routes/(main)/community/(detail)/workspace/loading.tsx
index 5b2f4509ff9..d2048161ea2 100644
--- a/src/routes/(main)/community/(detail)/workspace/loading.tsx
+++ b/src/routes/(main)/community/(detail)/workspace/loading.tsx
@@ -1,9 +1,11 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo } from 'react';
+import { ArticleSkeleton } from '@/components/Skeleton';
import ListLoading from '@/routes/(main)/community/components/ListLoading';
import Banner from './features/Header/Banner';
@@ -18,7 +20,7 @@ const Loading = memo(() => {
size={64}
style={{ boxShadow: `0 0 0 4px ${cssVar.colorBgContainer}`, flexShrink: 0 }}
/>
- <Skeleton paragraph={{ rows: 1 }} />
+ <ArticleSkeleton rows={1} />
</Flexbox>
<ListLoading length={4} rows={4} />
diff --git a/src/routes/(main)/community/(list)/(home)/index.tsx b/src/routes/(main)/community/(list)/(home)/index.tsx
index 995f2ed7337..3ad2b5ff1bd 100644
--- a/src/routes/(main)/community/(list)/(home)/index.tsx
+++ b/src/routes/(main)/community/(list)/(home)/index.tsx
@@ -2,6 +2,7 @@
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { SWRConfig } from 'swr';
import AsyncBoundary from '@/components/AsyncBoundary';
import { useDiscoverStore } from '@/store/discover';
@@ -13,7 +14,7 @@ import AssistantList from '../agent/features/List';
import McpList from '../mcp/features/List';
import CreatorRewardBanner from './features/CreatorRewardBanner';
-const HomePage = memo(() => {
+const HomeSections = memo(() => {
const { t } = useTranslation('discover');
const useAssistantList = useDiscoverStore((s) => s.useAssistantList);
const useMcpList = useDiscoverStore((s) => s.useFetchMcpList);
@@ -43,6 +44,9 @@ const HomePage = memo(() => {
// 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
//
+ // The two featured lists are gated independently (see AsyncBoundary), so this
+ // page opts out of the subtree's suspense: a failing list must surface its own
+ // Retry instead of throwing the whole page to the route error boundary.
return (
<>
<CreatorRewardBanner />
@@ -75,4 +79,18 @@ const HomePage = memo(() => {
);
});
+HomeSections.displayName = 'CommunityHomeSections';
+
+/**
+ * The two featured lists are gated independently (see `AsyncBoundary`), so this
+ * page opts out of the subtree's suspense: a list that fails must surface its own
+ * Retry instead of throwing the whole page to the route error boundary. The
+ * sections live in a child because `SWRConfig` only reaches hooks below it.
+ */
+const HomePage = memo(() => (
+ <SWRConfig value={{ suspense: false }}>
+ <HomeSections />
+ </SWRConfig>
+));
+
export default HomePage;
diff --git a/src/routes/(main)/community/(list)/_layout/index.tsx b/src/routes/(main)/community/(list)/_layout/index.tsx
index 538a957ba8b..ab4d28246b8 100644
--- a/src/routes/(main)/community/(list)/_layout/index.tsx
+++ b/src/routes/(main)/community/(list)/_layout/index.tsx
@@ -1,7 +1,10 @@
import { Flexbox } from '@lobehub/ui';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import WideScreenContainer from '@/features/WideScreenContainer';
+import { RouteSkeletonChromeProvider } from '@/spa/router/routeSkeletonChrome';
import { MAX_WIDTH } from '../../features/const';
import Footer from './Footer';
@@ -24,7 +27,13 @@ const Layout = () => {
}}
>
<Flexbox gap={16} style={{ paddingBlockEnd: 40 }} width={'100%'}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <RouteSkeletonChromeProvider>
+ <Outlet />
+ </RouteSkeletonChromeProvider>
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
<div className={styles.spacer} />
<Footer />
diff --git a/src/routes/(main)/community/(list)/agent/index.tsx b/src/routes/(main)/community/(list)/agent/index.tsx
index 547117b7b4d..02e2adcdf08 100644
--- a/src/routes/(main)/community/(list)/agent/index.tsx
+++ b/src/routes/(main)/community/(list)/agent/index.tsx
@@ -13,12 +13,11 @@ import { DiscoverTab } from '@/types/discover';
import AssistantEmpty from '../../features/AssistantEmpty';
import Pagination from '../features/Pagination';
import List from './features/List';
-import Loading from './loading';
const AssistantPage = memo(() => {
const query = useQuery() as AssistantQueryParams;
const useAssistantList = useDiscoverStore((s) => s.useAssistantList);
- const { data, isLoading, error, mutate } = useAssistantList(buildAssistantListQuery(query));
+ const { data, error, mutate } = useAssistantList(buildAssistantListQuery(query));
const items = data?.items ?? [];
@@ -29,8 +28,6 @@ const AssistantPage = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading}
- loading={<Loading />}
onRetry={() => mutate()}
>
{data && (
diff --git a/src/routes/(main)/community/(list)/agent/loading.tsx b/src/routes/(main)/community/(list)/agent/loading.tsx
deleted file mode 100644
index 605487f2409..00000000000
--- a/src/routes/(main)/community/(list)/agent/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(list)/mcp/index.tsx b/src/routes/(main)/community/(list)/mcp/index.tsx
index 9ddcc238a70..f6badbff338 100644
--- a/src/routes/(main)/community/(list)/mcp/index.tsx
+++ b/src/routes/(main)/community/(list)/mcp/index.tsx
@@ -12,12 +12,11 @@ import { DiscoverTab, McpSorts } from '@/types/discover';
import McpEmpty from '../../features/McpEmpty';
import Pagination from '../features/Pagination';
import List from './features/List';
-import Loading from './loading';
const McpPage = memo(() => {
const { q, page, category, sort, order } = useQuery() as McpQueryParams;
const useMcpList = useDiscoverStore((s) => s.useFetchMcpList);
- const { data, isLoading, error, mutate } = useMcpList({
+ const { data, error, mutate } = useMcpList({
category,
order,
page,
@@ -35,8 +34,6 @@ const McpPage = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading}
- loading={<Loading />}
onRetry={() => mutate()}
>
{data && (
diff --git a/src/routes/(main)/community/(list)/mcp/loading.tsx b/src/routes/(main)/community/(list)/mcp/loading.tsx
deleted file mode 100644
index 605487f2409..00000000000
--- a/src/routes/(main)/community/(list)/mcp/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(list)/model/index.tsx b/src/routes/(main)/community/(list)/model/index.tsx
index e1995c3af0e..30462a995bf 100644
--- a/src/routes/(main)/community/(list)/model/index.tsx
+++ b/src/routes/(main)/community/(list)/model/index.tsx
@@ -12,12 +12,11 @@ import { DiscoverTab } from '@/types/discover';
import ModelEmpty from '../../features/ModelEmpty';
import Pagination from '../features/Pagination';
import List from './features/List';
-import Loading from './loading';
const ModelPage = memo<{ mobile?: boolean }>(() => {
const { q, page, category, sort, order } = useQuery() as ModelQueryParams;
const useModelList = useDiscoverStore((s) => s.useModelList);
- const { data, isLoading, error, mutate } = useModelList({
+ const { data, error, mutate } = useModelList({
category,
order,
page,
@@ -35,8 +34,6 @@ const ModelPage = memo<{ mobile?: boolean }>(() => {
error={error}
errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading}
- loading={<Loading />}
onRetry={() => mutate()}
>
{data && (
diff --git a/src/routes/(main)/community/(list)/model/loading.tsx b/src/routes/(main)/community/(list)/model/loading.tsx
deleted file mode 100644
index 605487f2409..00000000000
--- a/src/routes/(main)/community/(list)/model/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(list)/provider/index.tsx b/src/routes/(main)/community/(list)/provider/index.tsx
index fe303d1d668..384e95878d7 100644
--- a/src/routes/(main)/community/(list)/provider/index.tsx
+++ b/src/routes/(main)/community/(list)/provider/index.tsx
@@ -12,12 +12,11 @@ import { DiscoverTab } from '@/types/discover';
import ProviderEmpty from '../../features/ProviderEmpty';
import Pagination from '../features/Pagination';
import List from './features/List';
-import Loading from './loading';
const ProviderPage = memo(() => {
const { q, page, sort, order } = useQuery() as ProviderQueryParams;
const useProviderList = useDiscoverStore((s) => s.useProviderList);
- const { data, isLoading, error, mutate } = useProviderList({
+ const { data, error, mutate } = useProviderList({
order,
page,
pageSize: 21,
@@ -34,8 +33,6 @@ const ProviderPage = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading}
- loading={<Loading />}
onRetry={() => mutate()}
>
{data && (
diff --git a/src/routes/(main)/community/(list)/provider/loading.tsx b/src/routes/(main)/community/(list)/provider/loading.tsx
deleted file mode 100644
index 605487f2409..00000000000
--- a/src/routes/(main)/community/(list)/provider/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/(list)/skill/index.tsx b/src/routes/(main)/community/(list)/skill/index.tsx
index 7e87e9c4bb1..3cd154a0d9f 100644
--- a/src/routes/(main)/community/(list)/skill/index.tsx
+++ b/src/routes/(main)/community/(list)/skill/index.tsx
@@ -12,12 +12,11 @@ import { DiscoverTab, SkillSorts } from '@/types/discover';
import SkillEmpty from '../../features/SkillEmpty';
import Pagination from '../features/Pagination';
import List from './features/List';
-import Loading from './loading';
const SkillPage = memo(() => {
const { q, page, category, sort, order } = useQuery() as SkillQueryParams;
const useSkillList = useDiscoverStore((s) => s.useFetchSkillList);
- const { data, isLoading, error, mutate } = useSkillList({
+ const { data, error, mutate } = useSkillList({
category,
order,
page,
@@ -35,8 +34,6 @@ const SkillPage = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={items.length === 0}
- isLoading={isLoading}
- loading={<Loading />}
onRetry={() => mutate()}
>
{data && (
diff --git a/src/routes/(main)/community/(list)/skill/loading.tsx b/src/routes/(main)/community/(list)/skill/loading.tsx
deleted file mode 100644
index 605487f2409..00000000000
--- a/src/routes/(main)/community/(list)/skill/loading.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from '../../components/ListLoading';
diff --git a/src/routes/(main)/community/components/ListLoading.tsx b/src/routes/(main)/community/components/ListLoading.tsx
index fb7b84219e6..1bdda5e29d0 100644
--- a/src/routes/(main)/community/components/ListLoading.tsx
+++ b/src/routes/(main)/community/components/ListLoading.tsx
@@ -1,65 +1,31 @@
'use client';
-import { Block, Flexbox, Grid, Skeleton } from '@lobehub/ui';
-import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
+import { cssVar, useResponsive } from 'antd-style';
import { memo } from 'react';
-const styles = createStaticStyles(({ css, cssVar }) => ({
- footer: css`
- border-block-start: 1px dashed ${cssVar.colorBorder};
- background: ${cssVar.colorBgContainer};
- `,
-}));
+import {
+ ArticleSkeleton,
+ CommunityListSkeleton,
+ type CommunityListSkeletonProps,
+} from '@/components/Skeleton';
-const ListLoading = memo<{ length?: number; rows?: number }>(({ rows = 3, length = 12 }) => {
- return (
- <Grid rows={rows} width={'100%'}>
- {Array.from({ length }).map((_, index) => (
- <Block gap={12} key={index} padding={16} variant={'outlined'}>
- {/* Header */}
- <Flexbox horizontal align={'center'} gap={12}>
- <Skeleton.Avatar active shape="square" size={40} style={{ flex: 'none' }} />
- <Flexbox flex={1} gap={4}>
- <Skeleton.Button active style={{ height: 20, width: '70%' }} />
- <Skeleton.Button active style={{ height: 14, width: '40%' }} />
- </Flexbox>
- </Flexbox>
-
- {/* Description */}
- <Skeleton.Paragraph active rows={3} style={{ marginBottom: 0 }} />
-
- {/* Tags */}
- <Flexbox horizontal gap={8}>
- <Skeleton.Button active size={'small'} style={{ height: 20, width: 60 }} />
- <Skeleton.Button active size={'small'} style={{ height: 20, width: 50 }} />
- </Flexbox>
-
- {/* Footer */}
- <Flexbox
- className={styles.footer}
- gap={4}
- padding={8}
- style={{ marginBottom: -16, marginInline: -16 }}
- >
- <Skeleton.Button active size={'small'} style={{ height: 14, width: 100 }} />
- </Flexbox>
- </Block>
- ))}
- </Grid>
- );
-});
+const ListLoading = memo<CommunityListSkeletonProps>((props) => (
+ <CommunityListSkeleton chrome={'body'} {...props} />
+));
export const DetailsLoading = memo(() => {
const { mobile } = useResponsive();
return (
<Flexbox gap={24}>
<Flexbox gap={12}>
- {!mobile && <Skeleton paragraph={{ rows: 1 }} style={{ width: 200 }} title={false} />}
+ {!mobile && <ArticleSkeleton rows={1} style={{ width: 200 }} title={false} />}
<Flexbox horizontal align={'center'} gap={16} width={'100%'}>
- <Skeleton.Avatar active size={mobile ? 48 : 64} />
- <Skeleton.Button active style={{ height: 36, width: 200 }} />
+ <Skeleton.Avatar size={mobile ? 48 : 64} />
+ <Skeleton height={36} width={200} />
</Flexbox>
- <Skeleton.Button active size={'small'} style={{ width: 200 }} />
+ <Skeleton height={28} width={200} />
</Flexbox>
<Flexbox
horizontal
@@ -69,8 +35,8 @@ export const DetailsLoading = memo(() => {
borderBottom: `1px solid ${cssVar.colorBorder}`,
}}
>
- <Skeleton.Button />
- <Skeleton.Button />
+ <Skeleton height={36} />
+ <Skeleton height={36} />
</Flexbox>
<Flexbox
gap={48}
@@ -85,13 +51,13 @@ export const DetailsLoading = memo(() => {
overflow: 'hidden',
}}
>
- <Skeleton paragraph={{ rows: 3 }} title={false} />
- <Skeleton paragraph={{ rows: 8 }} title={false} />
- <Skeleton paragraph={{ rows: 8 }} title={false} />
+ <Skeleton.Text rows={3} />
+ <Skeleton.Text rows={8} />
+ <Skeleton.Text rows={8} />
</Flexbox>
<Flexbox gap={16} width={360}>
- <Skeleton paragraph={{ rows: 3 }} title={false} />
- <Skeleton paragraph={{ rows: 4 }} title={false} />
+ <Skeleton.Text rows={3} />
+ <Skeleton.Text rows={4} />
</Flexbox>
</Flexbox>
</Flexbox>
diff --git a/src/routes/(main)/community/features/UserAvatar/index.tsx b/src/routes/(main)/community/features/UserAvatar/index.tsx
index cd35035d7d5..4fef13f7f5f 100644
--- a/src/routes/(main)/community/features/UserAvatar/index.tsx
+++ b/src/routes/(main)/community/features/UserAvatar/index.tsx
@@ -1,7 +1,6 @@
'use client';
-import { Skeleton } from '@lobehub/ui';
-import { Avatar, Button } from '@lobehub/ui/base-ui';
+import { Avatar, Button, Skeleton } from '@lobehub/ui/base-ui';
import { UserCircleIcon } from 'lucide-react';
import { memo, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -92,7 +91,7 @@ const UserAvatar = memo<UserAvatarProps>(({ avatarOverride }) => {
}, [isWorkspaceScope, navigate, userProfile?.userName, userProfile?.namespace]);
if (isLoading) {
- return <Skeleton.Avatar active shape={'square'} size={28} style={{ borderRadius: 6 }} />;
+ return <Skeleton.Avatar shape={'square'} size={28} style={{ borderRadius: 6 }} />;
}
// If trustedClient is enabled, skip the "become a creator" button and show the avatar directly
diff --git a/src/routes/(main)/eval/_layout/Sidebar/Content.tsx b/src/routes/(main)/eval/_layout/Sidebar/Content.tsx
index 11a47e4c7a5..e927db26623 100644
--- a/src/routes/(main)/eval/_layout/Sidebar/Content.tsx
+++ b/src/routes/(main)/eval/_layout/Sidebar/Content.tsx
@@ -1,10 +1,22 @@
'use client';
+import { SWRConfig } from 'swr';
+
import SideBarLayout from '@/features/NavPanel/SideBarLayout';
import Body from './Body';
import Header from './Header';
-const EvalSidebarContent = () => <SideBarLayout body={<Body />} header={<Header />} />;
+/**
+ * The sidebar is persistent chrome, not route content: it outlives every route
+ * under it and its lists carry their own Retry. Route-wide `suspense` would let
+ * one failing list throw past them to the route boundary and blank the whole
+ * eval workspace, so the sidebar opts out.
+ */
+const EvalSidebarContent = () => (
+ <SWRConfig value={{ suspense: false }}>
+ <SideBarLayout body={<Body />} header={<Header />} />
+ </SWRConfig>
+);
export default EvalSidebarContent;
diff --git a/src/routes/(main)/eval/_layout/index.tsx b/src/routes/(main)/eval/_layout/index.tsx
index 22424d8be75..e01d0e2b262 100644
--- a/src/routes/(main)/eval/_layout/index.tsx
+++ b/src/routes/(main)/eval/_layout/index.tsx
@@ -2,9 +2,18 @@
import { type FC } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
const EvalLayout: FC = () => {
- return <Outlet />;
+ return (
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
+ );
};
export default EvalLayout;
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Header/BenchmarkHead.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Header/BenchmarkHead.tsx
index 0beb7373679..b0ed98e7d7a 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Header/BenchmarkHead.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Header/BenchmarkHead.tsx
@@ -1,8 +1,8 @@
'use client';
import { type DropdownItem } from '@lobehub/ui';
-import { Block, Center, DropdownMenu, Skeleton, stopPropagation } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { Block, Center, DropdownMenu, stopPropagation } from '@lobehub/ui';
+import { ActionIcon, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import {
Activity,
@@ -105,7 +105,7 @@ const BenchmarkHead = memo<{ id: string }>(({ id }) => {
<Icon size={18} />
</Center>
{!name ? (
- <Skeleton active paragraph={false} title={{ style: { marginBottom: 0 }, width: 80 }} />
+ <Skeleton.Text width={80} />
) : (
<DropdownMenu items={menuItems} placement="bottomRight">
<Center
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/index.tsx
index b750f53175b..33f3c79ccc5 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/index.tsx
@@ -1,8 +1,8 @@
'use client';
import { Flexbox } from '@lobehub/ui';
-import { Button, confirmModal, Text, toast } from '@lobehub/ui/base-ui';
-import { Card, Skeleton } from 'antd';
+import { Button, confirmModal, Skeleton, Text, toast } from '@lobehub/ui/base-ui';
+import { Card } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import { Plus } from 'lucide-react';
import { memo, useCallback, useState } from 'react';
@@ -194,11 +194,11 @@ const DatasetsTab = memo<DatasetsTabProps>(
<div className={loadingStyles.header}>
<div className={loadingStyles.icon} />
<Flexbox flex={1} gap={8}>
- <Skeleton.Input active size="small" style={{ height: 16, width: 120 }} />
- <Skeleton.Input active size="small" style={{ height: 12, width: 200 }} />
+ <Skeleton height={16} width={120} />
+ <Skeleton height={12} width={200} />
</Flexbox>
- <Skeleton.Button active size="small" style={{ height: 36, width: 64 }} />
- <Skeleton.Button active size="small" style={{ height: 28, width: 64 }} />
+ <Skeleton height={36} width={64} />
+ <Skeleton height={28} width={64} />
</div>
</Card>
))}
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/index.tsx
index a062f1dd2ad..38fe6c32538 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/index.tsx
@@ -117,10 +117,10 @@ const BenchmarkDetail = memo(() => {
{/* Header skeleton */}
<Flexbox gap={16}>
<Flexbox horizontal align="start" gap={12}>
- <Skeleton.Avatar active shape="square" size={40} style={{ borderRadius: cssVar.borderRadiusLG }} />
+ <Skeleton.Avatar shape="square" size={40} style={{ borderRadius: cssVar.borderRadiusLG }} />
<Flexbox flex={1} gap={8}>
- <Skeleton.Input active style={{ height: 24, width: 200 }} />
- <Skeleton.Input active size="small" style={{ height: 14, width: 320 }} />
+ <Skeleton.Input style={{ height: 24, width: 200 }} />
+ <Skeleton.Input size="small" style={{ height: 14, width: 320 }} />
</Flexbox>
</Flexbox>
</Flexbox>
@@ -140,17 +140,14 @@ const BenchmarkDetail = memo(() => {
>
<Flexbox gap={12}>
<Flexbox horizontal align="center" gap={8}>
- <Skeleton.Avatar
- active
- shape="square"
- size={36}
- style={{ borderRadius: cssVar.borderRadius }}
- />
- <Skeleton.Input active size="small" style={{ height: 14, width: 80 }} />
+ <Skeleton.Avatar shape="square"
+ size={36}
+ style={{ borderRadius: cssVar.borderRadius }} />
+ <Skeleton.Input size="small" style={{ height: 14, width: 80 }} />
</Flexbox>
<Flexbox gap={4}>
- <Skeleton.Input active style={{ height: 24, width: 60 }} />
- <Skeleton.Input active size="small" style={{ height: 12, width: 100 }} />
+ <Skeleton.Input style={{ height: 24, width: 60 }} />
+ <Skeleton.Input size="small" style={{ height: 12, width: 100 }} />
</Flexbox>
</Flexbox>
</Card>
@@ -158,10 +155,10 @@ const BenchmarkDetail = memo(() => {
</Flexbox>
{/* Section skeletons */}
- <Skeleton.Input active style={{ height: 16, width: 80 }} />
- <Skeleton.Input active style={{ height: 64, width: '100%' }} />
- <Skeleton.Input active style={{ height: 16, width: 80 }} />
- <Skeleton.Input active style={{ height: 64, width: '100%' }} />
+ <Skeleton.Input style={{ height: 16, width: 80 }} />
+ <Skeleton.Input style={{ height: 64, width: '100%' }} />
+ <Skeleton.Input style={{ height: 16, width: 80 }} />
+ <Skeleton.Input style={{ height: 64, width: '100%' }} />
</Flexbox>
);
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx
index f491fa095f8..ccdf01d8a00 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx
@@ -36,7 +36,6 @@ const CaseDetail = memo(() => {
const {
data: resultsData,
error: resultsError,
- isLoading: resultsLoading,
mutate: mutateResults,
} = useFetchRunResults(runId!, pollingConfig);
@@ -100,7 +99,6 @@ const CaseDetail = memo(() => {
error={resultsError}
errorVariant={'page'}
isEmpty={!caseResult}
- isLoading={resultsLoading}
onRetry={() => mutateResults()}
>
{caseResult && (
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx
index bd90cd73b4a..bab0691b27d 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx
@@ -1,12 +1,13 @@
'use client';
import { Checkbox, Tag } from '@lobehub/ui/base-ui';
-import { Badge, Skeleton, Table, Tooltip, Typography } from 'antd';
+import { Badge, Table, Tooltip, Typography } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { createStaticStyles, cssVar } from 'antd-style';
import { type FC, memo, useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { agentEvalService } from '@/services/agentEval';
const styles = createStaticStyles(({ css }) => ({
@@ -151,7 +152,7 @@ const BatchResumeContent: FC<BatchResumeContentProps> = ({
);
return loading ? (
- <Skeleton active paragraph={{ rows: 4 }} />
+ <ArticleSkeleton rows={4} />
) : (
<Table
columns={columns}
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/index.tsx
index 476d6d22ca6..160dc9ec2e8 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/index.tsx
@@ -78,7 +78,7 @@ const RunDetail = memo(() => {
const pollingConfig = { refreshInterval: isActive ? POLLING_INTERVAL : 0 };
- const { error, isLoading, mutate } = useFetchRunDetail(runId!, pollingConfig);
+ const { error, mutate } = useFetchRunDetail(runId!, pollingConfig);
useFetchRunResults(runId!, pollingConfig);
const hasResults = !!runResults?.results?.length;
@@ -109,7 +109,6 @@ const RunDetail = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={!runDetail}
- isLoading={isLoading}
onRetry={() => mutate()}
>
{runDetail && (
diff --git a/src/routes/(main)/eval/cases/[caseId]/index.tsx b/src/routes/(main)/eval/cases/[caseId]/index.tsx
index aae0957f718..ae81ece9121 100644
--- a/src/routes/(main)/eval/cases/[caseId]/index.tsx
+++ b/src/routes/(main)/eval/cases/[caseId]/index.tsx
@@ -18,7 +18,7 @@ const Page = memo(() => {
const useFetchTestCase = useEvalStore((s) => s.useFetchTestCase);
const useFetchDatasetDetail = useEvalStore((s) => s.useFetchDatasetDetail);
- const { data: testCase, error, isLoading, mutate } = useFetchTestCase(caseId);
+ const { data: testCase, error, mutate } = useFetchTestCase(caseId);
const { data: dataset } = useFetchDatasetDetail(testCase?.datasetId);
// A deleted or mistyped case id is an absent resource, not a failed request:
@@ -33,7 +33,6 @@ const Page = memo(() => {
error={isMissing ? undefined : error}
errorVariant={'page'}
isEmpty={isMissing || !testCase}
- isLoading={isLoading}
empty={
<Center flex={1}>
<Text type="secondary">{t('testCaseDetail.notFound')}</Text>
diff --git a/src/routes/(main)/eval/datasets/[datasetId]/index.tsx b/src/routes/(main)/eval/datasets/[datasetId]/index.tsx
index 2d69bb6ba98..65d8fd727e6 100644
--- a/src/routes/(main)/eval/datasets/[datasetId]/index.tsx
+++ b/src/routes/(main)/eval/datasets/[datasetId]/index.tsx
@@ -107,7 +107,7 @@ const DatasetDetail = memo(() => {
const refreshTestCases = useEvalStore((s) => s.refreshTestCases);
const refreshDatasetDetail = useEvalStore((s) => s.refreshDatasetDetail);
- const { data: dataset, error, isLoading, mutate } = useFetchDatasetDetail(datasetId);
+ const { data: dataset, error, mutate } = useFetchDatasetDetail(datasetId);
// Nullable: a dataset accumulated from captured cases belongs to no benchmark.
const benchmarkId: string | null =
(dataset as { benchmarkId?: string | null })?.benchmarkId ?? null;
@@ -209,7 +209,6 @@ const DatasetDetail = memo(() => {
error={error}
errorVariant={'page'}
isEmpty={!dataset}
- isLoading={isLoading}
onRetry={() => mutate()}
>
{dataset && (
diff --git a/src/routes/(main)/eval/features/Experiments/ExperimentDetailPage.tsx b/src/routes/(main)/eval/features/Experiments/ExperimentDetailPage.tsx
index 4f99c5c07da..24aa924d564 100644
--- a/src/routes/(main)/eval/features/Experiments/ExperimentDetailPage.tsx
+++ b/src/routes/(main)/eval/features/Experiments/ExperimentDetailPage.tsx
@@ -1,11 +1,13 @@
'use client';
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
import { useParams } from 'react-router';
import AsyncBoundary from '@/components/AsyncBoundary';
+import { ArticleSkeleton } from '@/components/Skeleton';
import { experimentSelectors, useEvalStore } from '@/store/eval';
import BenchmarksSection from './BenchmarksSection';
@@ -48,8 +50,8 @@ const ExperimentDetailPage = memo(() => {
isLoading={isLoading && !experiment}
loading={
<>
- <Skeleton active paragraph={{ rows: 2 }} title={{ width: 240 }} />
- <Skeleton active paragraph={{ rows: 6 }} title={false} />
+ <ArticleSkeleton rows={2} title={240} />
+ <Skeleton.Text rows={6} />
</>
}
onRetry={() => mutate()}
diff --git a/src/routes/(main)/eval/index.tsx b/src/routes/(main)/eval/index.tsx
index 73b7b427ec5..5e81db2f67e 100644
--- a/src/routes/(main)/eval/index.tsx
+++ b/src/routes/(main)/eval/index.tsx
@@ -1,11 +1,12 @@
'use client';
-import { Empty, Flexbox, Skeleton } from '@lobehub/ui';
-import { Button, Text } from '@lobehub/ui/base-ui';
+import { Empty, Flexbox } from '@lobehub/ui';
+import { Button, Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { Database, FlaskConical, Plus } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { SWRConfig } from 'swr';
import AsyncBoundary from '@/components/AsyncBoundary';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
@@ -76,19 +77,19 @@ const SkeletonGrid = memo(() => (
{[0, 1, 2, 3].map((i) => (
<Flexbox className={styles.skeletonCard} gap={16} key={i}>
<Flexbox horizontal gap={12}>
- <Skeleton.Avatar active shape={'square'} size={36} />
+ <Skeleton.Avatar shape={'square'} size={36} />
<Flexbox flex={1} gap={8}>
- <Skeleton.Button active size={'small'} style={{ height: 14, width: 160 }} />
- <Skeleton.Button active size={'small'} style={{ height: 12, width: 220 }} />
+ <Skeleton height={14} width={160} />
+ <Skeleton height={12} width={220} />
</Flexbox>
</Flexbox>
- <Skeleton.Button active block size={'small'} style={{ height: 64 }} />
+ <Skeleton height={64} />
</Flexbox>
))}
</div>
));
-const EvalOverview = memo(() => {
+const EvalOverviewContent = memo(() => {
const { t } = useTranslation('eval');
const benchmarkList = useEvalStore((s) => s.benchmarkList);
const useFetchBenchmarks = useEvalStore((s) => s.useFetchBenchmarks);
@@ -268,4 +269,17 @@ const EvalOverview = memo(() => {
);
});
+/**
+ * The overview holds three independently gated sections — experiments,
+ * benchmarks and datasets — each with its own `AsyncBoundary` and Retry. Under
+ * route-wide `suspense` the first failing fetch throws past all of them and
+ * replaces the healthy sections with a page-wide error, so the overview opts
+ * out. The opt-out has to sit *above* the hooks it covers, hence the wrapper.
+ */
+const EvalOverview = memo(() => (
+ <SWRConfig value={{ suspense: false }}>
+ <EvalOverviewContent />
+ </SWRConfig>
+));
+
export default EvalOverview;
diff --git a/src/routes/(main)/group/_layout/Sidebar/AddGroupMemberModal/AvailableAgentList.tsx b/src/routes/(main)/group/_layout/Sidebar/AddGroupMemberModal/AvailableAgentList.tsx
index 15cdfdf2120..b324b880cc0 100644
--- a/src/routes/(main)/group/_layout/Sidebar/AddGroupMemberModal/AvailableAgentList.tsx
+++ b/src/routes/(main)/group/_layout/Sidebar/AddGroupMemberModal/AvailableAgentList.tsx
@@ -1,8 +1,8 @@
'use client';
import { agentDisplayName } from '@lobechat/types';
-import { Flexbox, SearchBar, Skeleton } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Flexbox, SearchBar } from '@lobehub/ui';
+import { Skeleton, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { type ChangeEvent } from 'react';
@@ -113,9 +113,9 @@ const AvailableAgentList = memo<AvailableAgentListProps>(({ agents, isLoading })
<Flexbox flex={1} style={{ minHeight: 0 }}>
{isLoading ? (
<Flexbox gap={8} padding={8}>
- <Skeleton active paragraph={{ rows: 1 }} title={false} />
- <Skeleton active paragraph={{ rows: 1 }} title={false} />
- <Skeleton active paragraph={{ rows: 1 }} title={false} />
+ <Skeleton.Text rows={1} />
+ <Skeleton.Text rows={1} />
+ <Skeleton.Text rows={1} />
</Flexbox>
) : filteredAgents.length === 0 ? (
<AgentSelectionEmpty
diff --git a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
index ff387224618..9720be9d78f 100644
--- a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -1,7 +1,7 @@
import { GROUP_CHAT_TOPIC_URL } from '@lobechat/const';
import type { ChatTopicStatus } from '@lobechat/types';
-import { Flexbox, Icon, Skeleton, Tooltip } from '@lobehub/ui';
-import { Tag, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import { Skeleton, Tag, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, useTheme } from 'antd-style';
import { HashIcon, MessageSquareDashed } from 'lucide-react';
import { AnimatePresence, m } from 'motion/react';
@@ -353,8 +353,8 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, stat
<Suspense
fallback={
<Flexbox gap={8} paddingBlock={8} paddingInline={24} width={'100%'}>
- <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
- <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
+ <Skeleton height={18} width={'100%'} />
+ <Skeleton height={18} width={'100%'} />
</Flexbox>
}
>
diff --git a/src/routes/(main)/group/_layout/index.tsx b/src/routes/(main)/group/_layout/index.tsx
index f05baace3b9..8ce8e75d459 100644
--- a/src/routes/(main)/group/_layout/index.tsx
+++ b/src/routes/(main)/group/_layout/index.tsx
@@ -1,7 +1,9 @@
import { Flexbox } from '@lobehub/ui';
import { type FC } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import { isDesktop } from '@/const/version';
import { GroupNotFoundGuard } from '@/features/GroupNotFound';
import ProtocolUrlHandler from '@/features/ProtocolUrlHandler';
@@ -22,7 +24,11 @@ const Layout: FC = () => {
{/* Keep the sidebar interactive when the routed group is gone (deleted
or made private) — only the content area collapses to the 404 card. */}
<GroupNotFoundGuard>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</GroupNotFoundGuard>
</Flexbox>
<RegisterHotkeys />
diff --git a/src/routes/(main)/group/permission/index.tsx b/src/routes/(main)/group/permission/index.tsx
index 72da9995667..aa07258b19e 100644
--- a/src/routes/(main)/group/permission/index.tsx
+++ b/src/routes/(main)/group/permission/index.tsx
@@ -1,27 +1,23 @@
'use client';
-import { memo, Suspense } from 'react';
+import { memo } from 'react';
import { useParams } from 'react-router';
-import SurfaceSkeleton from '@/components/Skeleton/Surface';
import GroupPermission from '@/features/GroupPermission';
import ResourceConfigAccessGate from '@/features/ResourcePermission/ResourceConfigAccessGate';
const GroupPermissionPage = memo(() => {
const { gid } = useParams<{ gid: string }>();
+ // Managing who can do what is a configuration action: a chat-only member gets the same redirect + reason toast as on Group Profile.
return (
- <Suspense fallback={<SurfaceSkeleton variant={'form'} />}>
- {/* Managing who can do what is a configuration action: a chat-only member
- gets the same redirect + reason toast as on Group Profile. */}
- <ResourceConfigAccessGate
- redirectPath={`/group/${gid ?? ''}`}
- resourceId={gid}
- resourceType="agentGroup"
- >
- <GroupPermission />
- </ResourceConfigAccessGate>
- </Suspense>
+ <ResourceConfigAccessGate
+ redirectPath={`/group/${gid ?? ''}`}
+ resourceId={gid}
+ resourceType="agentGroup"
+ >
+ <GroupPermission />
+ </ResourceConfigAccessGate>
);
});
diff --git a/src/routes/(main)/group/profile/features/GroupProfile/GroupHeader.tsx b/src/routes/(main)/group/profile/features/GroupProfile/GroupHeader.tsx
index bc3118e134a..8a72621ea57 100644
--- a/src/routes/(main)/group/profile/features/GroupProfile/GroupHeader.tsx
+++ b/src/routes/(main)/group/profile/features/GroupProfile/GroupHeader.tsx
@@ -1,8 +1,8 @@
'use client';
import { EDITOR_DEBOUNCE_TIME } from '@lobechat/const';
-import { Block, Flexbox, Icon, Input, Skeleton, Tooltip } from '@lobehub/ui';
-import { toast } from '@lobehub/ui/base-ui';
+import { Block, Flexbox, Icon, Input, Tooltip } from '@lobehub/ui';
+import { Skeleton, toast } from '@lobehub/ui/base-ui';
import { debounce } from 'es-toolkit/compat';
import isEqual from 'fast-deep-equal';
import { PaletteIcon } from 'lucide-react';
@@ -162,8 +162,8 @@ const GroupHeader = memo(() => {
<Suspense
fallback={
<Flexbox gap={8}>
- <Skeleton.Button block style={{ height: 38 }} />
- <Skeleton.Button block style={{ height: 38 }} />
+ <Skeleton height={38} />
+ <Skeleton height={38} />
</Flexbox>
}
>
diff --git a/src/routes/(main)/group/profile/features/MemberProfile/AgentHeader.tsx b/src/routes/(main)/group/profile/features/MemberProfile/AgentHeader.tsx
index 5f2ee854df0..cbee86d1a69 100644
--- a/src/routes/(main)/group/profile/features/MemberProfile/AgentHeader.tsx
+++ b/src/routes/(main)/group/profile/features/MemberProfile/AgentHeader.tsx
@@ -1,8 +1,8 @@
'use client';
import { DEFAULT_AVATAR, EDITOR_DEBOUNCE_TIME } from '@lobechat/const';
-import { Block, Flexbox, Icon, Input, Skeleton, Tooltip } from '@lobehub/ui';
-import { toast } from '@lobehub/ui/base-ui';
+import { Block, Flexbox, Icon, Input, Tooltip } from '@lobehub/ui';
+import { Skeleton, toast } from '@lobehub/ui/base-ui';
import { debounce } from 'es-toolkit/compat';
import isEqual from 'fast-deep-equal';
import { PaletteIcon } from 'lucide-react';
@@ -199,8 +199,8 @@ const AgentHeader = memo<AgentHeaderProps>(({ readOnly, disabled: disabledProp }
<Suspense
fallback={
<Flexbox gap={8}>
- <Skeleton.Button block style={{ height: 38 }} />
- <Skeleton.Button block style={{ height: 38 }} />
+ <Skeleton height={38} />
+ <Skeleton height={38} />
</Flexbox>
}
>
diff --git a/src/routes/(main)/memory/(home)/index.tsx b/src/routes/(main)/memory/(home)/index.tsx
index cd14e26aab7..06086b7eac5 100644
--- a/src/routes/(main)/memory/(home)/index.tsx
+++ b/src/routes/(main)/memory/(home)/index.tsx
@@ -3,7 +3,6 @@ import { Flexbox } from '@lobehub/ui';
import { type FC } from 'react';
import AsyncBoundary from '@/components/AsyncBoundary';
-import MemorySkeleton from '@/components/Skeleton/Memory';
import NavHeader from '@/features/NavHeader';
import WideScreenContainer from '@/features/WideScreenContainer';
import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
@@ -23,16 +22,10 @@ const Home: FC = () => {
const roles = useUserMemoryStore((s) => s.roles);
const persona = useUserMemoryStore((s) => s.persona);
- const { isLoading: isTagsLoading, error: tagsError, mutate: mutateTags } = useFetchTags();
- const {
- isLoading: isPersonaLoading,
- error: personaError,
- mutate: mutatePersona,
- } = useFetchPersona();
+ const { error: tagsError, mutate: mutateTags } = useFetchTags();
+ const { error: personaError, mutate: mutatePersona } = useFetchPersona();
// const { EditorModalElement, openEditor } = usePersonaEditor();
- if (isTagsLoading || isPersonaLoading) return <MemorySkeleton />;
-
// Persona / tags feed the store, so a failed fetch left the render falling
// through to the "analyze to get started" onboarding — telling the user they
// have no memories when the load merely errored. Branch error before empty.
diff --git a/src/routes/(main)/memory/_layout/index.tsx b/src/routes/(main)/memory/_layout/index.tsx
index 8c7e3d99dc9..4526c007cc4 100644
--- a/src/routes/(main)/memory/_layout/index.tsx
+++ b/src/routes/(main)/memory/_layout/index.tsx
@@ -3,6 +3,10 @@
import { Flexbox } from '@lobehub/ui';
import { type FC } from 'react';
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
+
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
+import { RouteSkeletonChromeProvider } from '@/spa/router/routeSkeletonChrome';
import Sidebar from './Sidebar';
import { styles } from './style';
@@ -12,7 +16,13 @@ const DesktopMemoryLayout: FC = () => {
<>
<Sidebar />
<Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <RouteSkeletonChromeProvider>
+ <Outlet />
+ </RouteSkeletonChromeProvider>
+ </SuspenseRouteBoundary>
+ </SWRConfig>
</Flexbox>
</>
);
diff --git a/src/routes/(main)/memory/features/DetailLoading.tsx b/src/routes/(main)/memory/features/DetailLoading.tsx
index 314b71f0c76..f1a4c2f37cb 100644
--- a/src/routes/(main)/memory/features/DetailLoading.tsx
+++ b/src/routes/(main)/memory/features/DetailLoading.tsx
@@ -1,17 +1,21 @@
-import { Flexbox, Skeleton } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { memo } from 'react';
const DetailLoading = memo(() => {
return (
<>
- <Skeleton.Button active shape={'round'} size={'small'} width={64} />
- <Skeleton.Title active fontSize={20} lineHeight={1.4} />
- <Skeleton.Tags active count={2} />
+ <Skeleton height={28} radius={999} width={64} />
+ <Skeleton.Text fontSize={20} lineHeight={1.4} />
+ <Flexbox horizontal gap={8}>
+ <Skeleton height={22} radius={4} width={48} />
+ <Skeleton height={22} radius={4} width={48} />
+ </Flexbox>
<Flexbox horizontal align="center" gap={16} justify="space-between">
- <Skeleton.Tags active />
- <Skeleton.Tags active />
+ <Skeleton height={22} radius={4} width={48} />
+ <Skeleton height={22} radius={4} width={48} />
</Flexbox>
- <Skeleton.Paragraph active fontSize={16} rows={6} />
+ <Skeleton.Text fontSize={16} rows={6} />
</>
);
});
diff --git a/src/routes/(main)/memory/features/Loading.tsx b/src/routes/(main)/memory/features/Loading.tsx
index 95431e3839c..d22d7ffdab1 100644
--- a/src/routes/(main)/memory/features/Loading.tsx
+++ b/src/routes/(main)/memory/features/Loading.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Grid, Skeleton } from '@lobehub/ui';
+import { Flexbox, Grid } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
@@ -24,8 +25,8 @@ const Loading = memo<{ rows?: number; viewMode?: ViewMode }>(({ viewMode, rows =
<Flexbox gap={24} paddingBlock={24} style={{ paddingLeft: 32 }}>
{Array.from({ length: 3 }).map((_, i) => (
<Flexbox gap={8} key={i}>
- <Skeleton.Title active fontSize={18} lineHeight={1.4} width={'30%'} />
- <Skeleton.Paragraph active rows={4} style={{ marginBottom: 0 }} />
+ <Skeleton.Text fontSize={18} lineHeight={1.4} width={'30%'} />
+ <Skeleton.Text rows={4} style={{ marginBottom: 0 }} />
</Flexbox>
))}
</Flexbox>
@@ -36,11 +37,11 @@ const Loading = memo<{ rows?: number; viewMode?: ViewMode }>(({ viewMode, rows =
<Grid gap={12} maxItemWidth={240} paddingBlock={8} rows={rows}>
{Array.from({ length: 6 }).map((_, i) => (
<Flexbox className={styles.card} key={i}>
- <Skeleton.Title active fontSize={16} lineHeight={1.4} width={'80%'} />
- <Skeleton.Paragraph active rows={5} style={{ marginBottom: 0 }} />
+ <Skeleton.Text fontSize={16} lineHeight={1.4} width={'80%'} />
+ <Skeleton.Text rows={5} style={{ marginBottom: 0 }} />
<Flexbox horizontal gap={8}>
- <Skeleton.Button active size={'small'} style={{ height: 20, width: 60 }} />
- <Skeleton.Button active size={'small'} style={{ height: 20, width: 50 }} />
+ <Skeleton height={20} width={60} />
+ <Skeleton height={20} width={50} />
</Flexbox>
</Flexbox>
))}
diff --git a/src/routes/(mobile)/community/(detail)/_layout/index.tsx b/src/routes/(mobile)/community/(detail)/_layout/index.tsx
index 010d7048144..4446b2d2d70 100644
--- a/src/routes/(mobile)/community/(detail)/_layout/index.tsx
+++ b/src/routes/(mobile)/community/(detail)/_layout/index.tsx
@@ -1,6 +1,8 @@
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
import MobileContentLayout from '@/components/server/MobileNavLayout';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import Footer from '@/features/Setting/Footer';
import { SCROLL_PARENT_ID } from '@/routes/(main)/community/features/const';
@@ -9,7 +11,11 @@ import Header from './Header';
const Layout = () => {
return (
<MobileContentLayout gap={16} header={<Header />} id={SCROLL_PARENT_ID} padding={16}>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
<div />
<Footer />
</MobileContentLayout>
diff --git a/src/routes/(mobile)/community/(list)/_layout/index.tsx b/src/routes/(mobile)/community/(list)/_layout/index.tsx
index bc602f5ff5f..5cd54050a75 100644
--- a/src/routes/(mobile)/community/(list)/_layout/index.tsx
+++ b/src/routes/(mobile)/community/(list)/_layout/index.tsx
@@ -1,6 +1,8 @@
import { Outlet } from 'react-router';
+import { SWRConfig } from 'swr';
import MobileContentLayout from '@/components/server/MobileNavLayout';
+import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary';
import Footer from '@/features/Setting/Footer';
import { SCROLL_PARENT_ID } from '../../../../(main)/community/features/const';
@@ -16,7 +18,11 @@ const Layout = () => {
header={<Header />}
id={SCROLL_PARENT_ID}
>
- <Outlet />
+ <SWRConfig value={{ suspense: true }}>
+ <SuspenseRouteBoundary>
+ <Outlet />
+ </SuspenseRouteBoundary>
+ </SWRConfig>
<div />
<Footer />
</MobileContentLayout>
diff --git a/src/skeleton-gallery.tsx b/src/skeleton-gallery.tsx
new file mode 100644
index 00000000000..15fbd13b193
--- /dev/null
+++ b/src/skeleton-gallery.tsx
@@ -0,0 +1,52 @@
+import { Flexbox, ThemeProvider } from '@lobehub/ui';
+import { type ReactNode, Suspense } from 'react';
+import { createRoot } from 'react-dom/client';
+
+import { ArticleSkeleton } from '@/components/Skeleton';
+import ConversationListSkeleton from '@/components/Skeleton/Conversation/List';
+import TaskItemSkeleton from '@/features/AgentTasks/AgentTaskList/TaskItemSkeleton';
+import { BriefCardSkeleton } from '@/features/DailyBrief/BriefCardSkeleton';
+import ModelSkeletonList from '@/features/Settings/provider/features/ModelList/SkeletonList';
+import MemoryDetailLoading from '@/routes/(main)/memory/features/DetailLoading';
+import MemoryLoading from '@/routes/(main)/memory/features/Loading';
+
+const Case = ({ children, title }: { children: ReactNode; title: string }) => (
+ <Flexbox gap={12} style={{ borderBottom: '1px solid #eee', padding: 24 }} width={'100%'}>
+ <div style={{ fontSize: 12, fontWeight: 700, opacity: 0.5 }}>{title}</div>
+ <Suspense fallback={null}>{children}</Suspense>
+ </Flexbox>
+);
+
+createRoot(document.querySelector('#root')!).render(
+ <ThemeProvider>
+ <Flexbox style={{ margin: '0 auto', maxWidth: 900 }} width={'100%'}>
+ <Case title="ArticleSkeleton — title + 3 rows">
+ <ArticleSkeleton rows={3} />
+ </Case>
+ <Case title="ArticleSkeleton — avatar + 2 rows, title width 120">
+ <ArticleSkeleton avatar rows={2} title={120} />
+ </Case>
+ <Case title="ArticleSkeleton — rows only (title={false})">
+ <ArticleSkeleton rows={4} title={false} />
+ </Case>
+ <Case title="DailyBrief / BriefCardSkeleton">
+ <BriefCardSkeleton />
+ </Case>
+ <Case title="AgentTasks / TaskItemSkeleton">
+ <TaskItemSkeleton />
+ </Case>
+ <Case title="memory / Loading">
+ <MemoryLoading />
+ </Case>
+ <Case title="memory / DetailLoading">
+ <MemoryDetailLoading />
+ </Case>
+ <Case title="Settings / provider ModelList SkeletonList">
+ <ModelSkeletonList />
+ </Case>
+ <Case title="Conversation / List skeleton">
+ <ConversationListSkeleton />
+ </Case>
+ </Flexbox>
+ </ThemeProvider>,
+);
diff --git a/src/spa/BootShell/AppShellSkeleton.tsx b/src/spa/BootShell/AppShellSkeleton.tsx
index dfcd72bbf7e..70af261460e 100644
--- a/src/spa/BootShell/AppShellSkeleton.tsx
+++ b/src/spa/BootShell/AppShellSkeleton.tsx
@@ -2,8 +2,10 @@
import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
+import { LobeHub } from '@lobehub/ui/brand';
+import { createStaticStyles, keyframes } from 'antd-style';
+import { memo, useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { isDesktop } from '@/const/version';
import {
@@ -23,7 +25,73 @@ const CSS_VAR_CLASS = 'lobe-vars';
export const APP_SHELL_FALLBACK_ID = 'app-shell-fallback';
-const styles = createStaticStyles(({ css }) => ({
+/**
+ * A boot that hands over inside a second reads as a transition, not a wait, so
+ * the shell stays a bare brand mark. Past that the user is waiting on something
+ * and deserves to be told so.
+ *
+ * Measured from the document, not from this component: the static HTML logo is
+ * already on screen before any bundle runs, and the shell itself only mounts
+ * `BOOT_SHELL_DELAY` after React's first commit. Timing from mount would restart
+ * the clock the user has been watching all along, and on the slow boots that
+ * need the hint most it would arrive last.
+ */
+const HINT_DELAY = 1000;
+
+const sinceDocument = () => performance.now() - (window.__LOBE_BOOT_T_HTML__ ?? 0);
+
+// The X half of the transform is the centering, not the motion — it has to be
+// restated in both frames or the keyframe overwrites it and the caption jumps
+// to the anchor's left edge.
+const slideUp = keyframes`
+ from {
+ opacity: 0;
+ transform: translate(-50%, 10px);
+ }
+
+ to {
+ opacity: 1;
+ transform: translate(-50%, 0);
+ }
+`;
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ contentBrand: css`
+ pointer-events: none;
+
+ position: absolute;
+ inset: 0;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ color: ${cssVar.colorTextQuaternary};
+ `,
+ // The mark carries the fade, not the whole stack: multiplying it into the
+ // caption too leaves quaternary text at ~0.2 alpha, which is unreadable.
+ mark: css`
+ opacity: 0.48;
+ `,
+ // Floated rather than stacked in flow: a caption that joins the column would
+ // push the brand mark off the center it shares with the app that replaces it.
+ hint: css`
+ position: absolute;
+ inset-block-start: calc(100% + 8px);
+ inset-inline-start: 50%;
+
+ font-size: 13px;
+ color: ${cssVar.colorTextTertiary};
+ white-space: nowrap;
+
+ animation: ${slideUp} 0.42s ${cssVar.motionEaseOut} both;
+ `,
+ brand: css`
+ position: relative;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ `,
dragRegion: css`
pointer-events: auto;
flex-shrink: 0;
@@ -42,12 +110,34 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
+/**
+ * Split out so `useTranslation` runs only once the hint is due. The boot shell
+ * is a sibling of `RouterProvider` and renders before the tree that initializes
+ * i18n, so calling it up front would hit react-i18next with no instance —
+ * a console warning and a first render that echoes the raw key.
+ */
+const LoadingHint = memo(() => {
+ const { t } = useTranslation('common');
+
+ return <div className={styles.hint}>{t('loading')}</div>;
+});
+
+LoadingHint.displayName = 'AppShellLoadingHint';
+
interface AppShellSkeletonProps {
id?: string;
}
const AppShellSkeleton = memo<AppShellSkeletonProps>(({ id }) => {
const { isDark, navPanelBackground, navPanelWidth, showLeftPanel } = readBootShellGeometry();
+ const [waiting, setWaiting] = useState(() => sinceDocument() >= HINT_DELAY);
+
+ useEffect(() => {
+ if (waiting) return;
+
+ const timer = setTimeout(() => setWaiting(true), HINT_DELAY - sinceDocument());
+ return () => clearTimeout(timer);
+ }, [waiting]);
return (
<div aria-hidden className={`${CSS_VAR_CLASS} ${styles.root}`} id={id}>
@@ -79,7 +169,16 @@ const AppShellSkeleton = memo<AppShellSkeletonProps>(({ id }) => {
height={'100%'}
style={getInnerCssVariables({ isDark })}
width={'100%'}
- />
+ >
+ <div className={styles.contentBrand}>
+ <div className={styles.brand}>
+ <div className={styles.mark}>
+ <LobeHub size={56} type={'mono'} />
+ </div>
+ {waiting && <LoadingHint />}
+ </div>
+ </div>
+ </Flexbox>
</Flexbox>
</Flexbox>
</div>
diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsx
index fef6eaba7d2..a7257257830 100644
--- a/src/spa/router/desktopRouter.shared.tsx
+++ b/src/spa/router/desktopRouter.shared.tsx
@@ -26,6 +26,7 @@ import {
} from '@/business/client/BusinessDesktopRoutes';
import BrandTextLoading from '@/components/Loading/BrandTextLoading';
import AppsSkeleton from '@/components/Skeleton/Apps';
+import CommunityListSkeleton from '@/components/Skeleton/CommunityList';
import ConversationLayoutSkeleton from '@/components/Skeleton/Conversation/Layout';
import ConversationSegmentSkeleton from '@/components/Skeleton/Conversation/Segment';
import GenerationSkeleton from '@/components/Skeleton/Generation';
@@ -503,7 +504,7 @@ export const sharedMainAreaChildren: RouteObject[] = [
'Desktop > Discover > List > Layout',
{ preloadId: 'community' },
),
- handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('grid') }) },
+ handle: { meta: routeMeta({ Skeleton: CommunityListSkeleton }) },
},
// Detail routes (with DetailLayout)
{
diff --git a/src/spa/router/mobileRouter.test.tsx b/src/spa/router/mobileRouter.test.tsx
index c8da6e5afa7..ee80a3eff53 100644
--- a/src/spa/router/mobileRouter.test.tsx
+++ b/src/spa/router/mobileRouter.test.tsx
@@ -42,3 +42,25 @@ describe('mobileRouter workspace provider routes', () => {
expect(source).toContain("path: 'provider/:providerId'");
});
});
+
+describe('mobile community route layouts', () => {
+ it('wraps shared community list and detail pages in SWR suspense boundaries', async () => {
+ const readLayout = (layoutPath: string) =>
+ readFile(path.join(process.cwd(), layoutPath), 'utf8');
+
+ const [listLayout, detailLayout] = await Promise.all([
+ readLayout('src/routes/(mobile)/community/(list)/_layout/index.tsx'),
+ readLayout('src/routes/(mobile)/community/(detail)/_layout/index.tsx'),
+ ]);
+
+ for (const source of [listLayout, detailLayout]) {
+ expect(source).toContain("import { SWRConfig } from 'swr'");
+ expect(source).toContain(
+ "import SuspenseRouteBoundary from '@/components/SuspenseRouteBoundary'",
+ );
+ expect(source).toContain('<SWRConfig value={{ suspense: true }}>');
+ expect(source).toContain('<SuspenseRouteBoundary>');
+ expect(source).toContain('<Outlet />');
+ }
+ });
+});
diff --git a/src/spa/router/routeSkeletonChrome.tsx b/src/spa/router/routeSkeletonChrome.tsx
new file mode 100644
index 00000000000..6b5a9a7250a
--- /dev/null
+++ b/src/spa/router/routeSkeletonChrome.tsx
@@ -0,0 +1,23 @@
+'use client';
+
+import { createContext, type ReactNode, use } from 'react';
+
+import type { RouteSkeletonChrome } from './routeMeta';
+
+const RouteSkeletonChromeContext = createContext<RouteSkeletonChrome>('page');
+
+/**
+ * A route fallback renders inside whatever layout has already mounted, so it
+ * cannot know on its own whether it stands in for the whole surface or only for
+ * the outlet. A layout that draws its own chrome declares `body` around its
+ * `Outlet`, and the skeleton drops the header it would otherwise duplicate.
+ */
+export const RouteSkeletonChromeProvider = ({
+ children,
+ value = 'body',
+}: {
+ children: ReactNode;
+ value?: RouteSkeletonChrome;
+}) => <RouteSkeletonChromeContext value={value}>{children}</RouteSkeletonChromeContext>;
+
+export const useRouteSkeletonChrome = () => use(RouteSkeletonChromeContext);