Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(ui): separate spinner primitives from loading layouts (#42473)

yyh48189fedb407
diff --git a/packages/dify-ui/README.md b/packages/dify-ui/README.md
index db32e4e26dd..d124e42c99f 100644
--- a/packages/dify-ui/README.md
+++ b/packages/dify-ui/README.md
@@ -39,7 +39,7 @@ Import `styles.css` once from the consumer's root stylesheet or entrypoint.
| Actions | `./button`, `./icon-button`, `./toggle` |
| Controls | `./segmented-control` |
| Display | `./collapsible`, `./kbd` |
-| Feedback | `./meter`, `./progress`, `./status-dot`, `./toast` |
+| Feedback | `./meter`, `./progress`, `./spinner`, `./status-dot`, `./toast` |
| Form | `./form`, `./field`, `./fieldset`, `./input`, `./input-group`, `./textarea`, `./checkbox`, `./checkbox-group`, `./radio-group`, `./number-field`, `./select`, `./slider`, `./switch` |
| Layout | `./scroll-area` |
| Media | `./avatar` |
diff --git a/packages/dify-ui/package.json b/packages/dify-ui/package.json
index 71da5d3d9d7..8084254b75f 100644
--- a/packages/dify-ui/package.json
+++ b/packages/dify-ui/package.json
@@ -160,6 +160,10 @@
"./tooltip": {
"types": "./src/tooltip/index.tsx",
"import": "./src/tooltip/index.tsx"
+ },
+ "./spinner": {
+ "types": "./src/spinner/index.tsx",
+ "import": "./src/spinner/index.tsx"
}
},
"scripts": {
diff --git a/packages/dify-ui/src/spinner/README.md b/packages/dify-ui/src/spinner/README.md
new file mode 100644
index 00000000000..f1ac8062eab
--- /dev/null
+++ b/packages/dify-ui/src/spinner/README.md
@@ -0,0 +1,19 @@
+# Spinner
+
+`Spinner` is a named, indeterminate progress indicator built on Base UI Progress. Supply exactly
+one accessible name through `aria-label` or `aria-labelledby`. Localization belongs to the
+consumer. The component fixes `value` to `null` and omits value text rather than exposing Base UI's
+English indeterminate fallback. It does not announce completion or manage the surrounding region's
+busy state; those belong to the feature's status owner.
+
+`SpinnerIcon` is the same decorative artwork for controls that already own their loading state and
+accessible name. It is always hidden from assistive technology. Do not place a second progress
+indicator inside a loading button.
+
+Both exports occupy only their own size (12, 16, or 20 pixels; default 16). `className` styles that
+size and color, not an enclosing page or panel. The four-square artwork, opacity sequence, two-second
+cycle, and reduced-motion still frame preserve the former Web Loading visual. The component
+retains its existing blue in both themes; a palette change is a separate design decision.
+
+Web owns loading placeholders, page geometry, translations, and data readiness. Do not add
+`app`, `area`, fullscreen, centering, request, delay, or content-replacement props here.
diff --git a/packages/dify-ui/src/spinner/index.stories.tsx b/packages/dify-ui/src/spinner/index.stories.tsx
new file mode 100644
index 00000000000..3f312709da5
--- /dev/null
+++ b/packages/dify-ui/src/spinner/index.stories.tsx
@@ -0,0 +1,62 @@
+import type { Meta, StoryObj } from '@storybook/react-vite'
+import { expect } from 'storybook/test'
+import { Spinner, SpinnerIcon } from '.'
+
+const meta = {
+ title: 'Base/UI/Spinner',
+ component: Spinner,
+ parameters: { layout: 'centered' },
+ tags: ['autodocs'],
+ args: { 'aria-label': 'Loading agent details' },
+} satisfies Meta<typeof Spinner>
+
+export default meta
+type Story = StoryObj<typeof meta>
+
+export const Default: Story = {
+ play: async ({ canvas }) => {
+ const progress = canvas.getByRole('progressbar', { name: 'Loading agent details' })
+ await expect(progress).not.toHaveAttribute('aria-valuenow')
+ await expect(progress).not.toHaveAttribute('aria-valuetext')
+ },
+}
+
+export const VisibleLabel: Story = {
+ render: () => (
+ <div className="flex items-center gap-2">
+ <Spinner aria-labelledby="spinner-label" />
+ <span id="spinner-label">Loading files</span>
+ </div>
+ ),
+ play: async ({ canvas }) => {
+ await expect(canvas.getByRole('progressbar', { name: 'Loading files' })).toBeVisible()
+ },
+}
+
+export const Sizes: Story = {
+ render: () => (
+ <div className="flex items-center gap-4">
+ <Spinner size="small" aria-label="Loading small preview" />
+ <Spinner size="medium" aria-label="Loading medium preview" />
+ <Spinner size="large" aria-label="Loading large preview" />
+ <Spinner className="size-8 text-text-primary" aria-label="Loading custom preview" />
+ </div>
+ ),
+}
+
+export const Decorative: Story = {
+ render: () => (
+ <button
+ type="button"
+ disabled
+ aria-label="Loading audio"
+ className="flex size-6 items-center justify-center"
+ >
+ <SpinnerIcon />
+ </button>
+ ),
+ play: async ({ canvas }) => {
+ await expect(canvas.getByRole('button', { name: 'Loading audio' })).toBeDisabled()
+ await expect(canvas.queryByRole('progressbar')).not.toBeInTheDocument()
+ },
+}
diff --git a/packages/dify-ui/src/spinner/index.tsx b/packages/dify-ui/src/spinner/index.tsx
new file mode 100644
index 00000000000..e5abe2e7809
--- /dev/null
+++ b/packages/dify-ui/src/spinner/index.tsx
@@ -0,0 +1,65 @@
+'use client'
+
+import type { ComponentProps } from 'react'
+import { Progress as BaseProgress } from '@base-ui/react/progress'
+import { cva } from 'class-variance-authority'
+import { cn } from '../cn'
+
+const spinnerVariants = cva('inline-flex shrink-0 text-[#1c64f2]', {
+ variants: {
+ size: {
+ small: 'size-3',
+ medium: 'size-4',
+ large: 'size-5',
+ },
+ },
+ defaultVariants: { size: 'medium' },
+})
+
+type SpinnerAppearanceProps = {
+ size?: 'small' | 'medium' | 'large'
+ className?: string
+}
+
+type SpinnerIconProps = SpinnerAppearanceProps
+
+type SpinnerProps = SpinnerAppearanceProps &
+ Pick<ComponentProps<'div'>, 'id' | 'aria-describedby'> &
+ (
+ | { 'aria-label': string; 'aria-labelledby'?: never }
+ | { 'aria-label'?: never; 'aria-labelledby': string }
+ )
+
+function SpinnerIcon({ size = 'medium', className }: SpinnerIconProps) {
+ return (
+ <svg
+ aria-hidden="true"
+ focusable="false"
+ viewBox="0 0 16 16"
+ fill="currentColor"
+ className={cn(spinnerVariants({ size }), className)}
+ data-dify-spinner=""
+ >
+ <rect x="9" width="7" height="7" rx="1" />
+ <rect x="9" y="9" width="7" height="7" rx="1" opacity="0.5" />
+ <rect y="9" width="7" height="7" rx="1" opacity="0.1" />
+ <rect width="7" height="7" rx="1" opacity="0.2" />
+ </svg>
+ )
+}
+
+function Spinner({ size = 'medium', className, ...props }: SpinnerProps) {
+ return (
+ <BaseProgress.Root
+ {...props}
+ value={null}
+ aria-valuetext={undefined}
+ className={cn(spinnerVariants({ size }), className)}
+ >
+ <SpinnerIcon className="size-full text-current" />
+ </BaseProgress.Root>
+ )
+}
+
+export { Spinner, SpinnerIcon }
+export type { SpinnerIconProps, SpinnerProps }
diff --git a/packages/dify-ui/src/styles/components.css b/packages/dify-ui/src/styles/components.css
index 06547b66320..f889ead1fe8 100644
--- a/packages/dify-ui/src/styles/components.css
+++ b/packages/dify-ui/src/styles/components.css
@@ -86,3 +86,41 @@
transition: none;
}
}
+
+[data-dify-spinner] > rect {
+ animation: dify-spinner-opacity 2s linear infinite;
+}
+
+[data-dify-spinner] > rect:nth-child(2) {
+ animation-delay: 0.5s;
+}
+[data-dify-spinner] > rect:nth-child(3) {
+ animation-delay: 1s;
+}
+[data-dify-spinner] > rect:nth-child(4) {
+ animation-delay: 1.5s;
+}
+
+@keyframes dify-spinner-opacity {
+ 0% {
+ opacity: 0;
+ }
+ 25% {
+ opacity: 0.1;
+ }
+ 50% {
+ opacity: 0.2;
+ }
+ 75% {
+ opacity: 0.5;
+ }
+ 100% {
+ opacity: 1;
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ [data-dify-spinner] > rect {
+ animation: none;
+ }
+}
diff --git a/web/__tests__/base/chat-flow.test.tsx b/web/__tests__/base/chat-flow.test.tsx
index f82ffdad606..7f7f3b2145a 100644
--- a/web/__tests__/base/chat-flow.test.tsx
+++ b/web/__tests__/base/chat-flow.test.tsx
@@ -186,7 +186,7 @@ describe('Base Chat Flow', () => {
const { container } = render(<ChatWithHistory className="mobile-chat-shell" />)
expect(useDocumentTitle).toHaveBeenCalledWith('Chat')
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(container.querySelector('.mobile-chat-shell')).toBeInTheDocument()
expect(container.querySelector('.rounded-t-2xl')).toBeInTheDocument()
expect(container.querySelector('.rounded-2xl')).not.toBeInTheDocument()
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
index e37f124dd9a..4df033cbffe 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
@@ -9,7 +9,7 @@ import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useShallow } from 'zustand/react/shallow'
import { useStore } from '@/app/components/app/store'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
workspacePermissionKeysAtom,
workspacePermissionKeysLoadingAtom,
@@ -218,7 +218,7 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
const content =
!appDetail || shouldBlockAgentResourceAccess || shouldBlockAccessPointAccess ? (
<div className="flex min-w-0 grow items-center justify-center bg-background-body">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : (
<div
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx
index 10a09d26416..7873d05e3a0 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx
@@ -37,7 +37,7 @@ import {
TencentIcon,
WeaveIcon,
} from '@/app/components/base/icons/src/public/tracing'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { userProfileQueryOptions } from '@/features/account-profile/client'
import { usePathname } from '@/next/navigation'
@@ -257,7 +257,7 @@ const Panel: FC = () => {
return (
<div className="mb-3 flex items-center justify-between">
<div className="w-50">
- <Loading />
+ <LoadingPlaceholder />
</div>
</div>
)
diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
index 8a304f946c7..1a181ac2511 100644
--- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
+++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
@@ -7,7 +7,7 @@ import { useAtomValue } from 'jotai'
import * as React from 'react'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import DatasetDetailContext from '@/context/dataset-detail'
import {
workspacePermissionKeysAtom,
@@ -153,7 +153,7 @@ const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
shouldRedirectUnauthorizedRoute
const documentTitleOwnedByChild = isDocumentDetailPath(pathname) && !shouldShowLoading
const content = shouldShowLoading ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : (
<div
className={cn(
diff --git a/web/app/(commonLayout)/datasets/layout.spec.tsx b/web/app/(commonLayout)/datasets/layout.spec.tsx
index 5821350e393..7a3dff397b9 100644
--- a/web/app/(commonLayout)/datasets/layout.spec.tsx
+++ b/web/app/(commonLayout)/datasets/layout.spec.tsx
@@ -71,7 +71,7 @@ describe('DatasetsLayout', () => {
</DatasetsLayout>,
)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByText('datasets')).not.toBeInTheDocument()
expect(mockReplace).not.toHaveBeenCalled()
})
@@ -88,7 +88,7 @@ describe('DatasetsLayout', () => {
</DatasetsLayout>,
)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByText('datasets')).not.toBeInTheDocument()
expect(mockReplace).not.toHaveBeenCalled()
})
diff --git a/web/app/(commonLayout)/datasets/layout.tsx b/web/app/(commonLayout)/datasets/layout.tsx
index 4cd87ffb8bb..9707df20008 100644
--- a/web/app/(commonLayout)/datasets/layout.tsx
+++ b/web/app/(commonLayout)/datasets/layout.tsx
@@ -2,7 +2,7 @@
import { useAtomValue } from 'jotai'
import { useEffect } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
workspacePermissionKeysAtom,
workspacePermissionKeysLoadingAtom,
@@ -52,7 +52,7 @@ export default function DatasetsLayout({ children }: { children: React.ReactNode
if (shouldRedirectToDatasets) router.replace('/datasets')
}, [shouldRedirectToDatasets, router])
- if (isLoadingAccess || !currentWorkspaceId) return <Loading type="app" />
+ if (isLoadingAccess || !currentWorkspaceId) return <LoadingPlaceholder className="h-full" />
if (shouldRedirectToDatasets) {
return null
diff --git a/web/app/(humanInputLayout)/form/[token]/__tests__/form.spec.tsx b/web/app/(humanInputLayout)/form/[token]/__tests__/form.spec.tsx
index 8d0bdcb4534..4ea39a7a665 100644
--- a/web/app/(humanInputLayout)/form/[token]/__tests__/form.spec.tsx
+++ b/web/app/(humanInputLayout)/form/[token]/__tests__/form.spec.tsx
@@ -116,9 +116,8 @@ vi.mock('@/app/components/base/chat/chat/answer/human-input-content/expiration-t
default: () => <div>expiration-time</div>,
}))
-vi.mock('@/app/components/base/loading', () => ({
- __esModule: true,
- default: () => <div>loading</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div>loading</div>,
}))
vi.mock('@/app/components/base/logo/dify-logo', () => ({
diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx
index d320bc27ebf..7f533ae16b1 100644
--- a/web/app/(humanInputLayout)/form/[token]/form.tsx
+++ b/web/app/(humanInputLayout)/form/[token]/form.tsx
@@ -5,7 +5,7 @@ import type { HumanInputFormError } from '@/service/use-share'
import type { HumanInputResolvedValue } from '@/types/workflow'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useDocumentTitle from '@/hooks/use-document-title'
import { useParams } from '@/next/navigation'
import { useGetHumanInputForm } from '@/service/use-share'
@@ -57,7 +57,7 @@ const FormContent = () => {
useDocumentTitle(documentTitle)
if (isLoading) {
- return <Loading type="app" />
+ return <LoadingPlaceholder className="h-full" />
}
if (success) {
diff --git a/web/app/(shareLayout)/components/authenticated-layout.tsx b/web/app/(shareLayout)/components/authenticated-layout.tsx
index 2f052672562..cf6736c6eb2 100644
--- a/web/app/(shareLayout)/components/authenticated-layout.tsx
+++ b/web/app/(shareLayout)/components/authenticated-layout.tsx
@@ -4,7 +4,7 @@ import * as React from 'react'
import { useCallback, useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useWebAppStore } from '@/context/web-app-context'
import { usePathname, useRouter, useSearchParams } from '@/next/navigation'
import { useGetUserCanAccessApp } from '@/service/access-control/use-app-access-control'
@@ -116,7 +116,7 @@ const AuthenticatedLayout = ({ children }: { children: React.ReactNode }) => {
) {
return (
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/(shareLayout)/components/splash.tsx b/web/app/(shareLayout)/components/splash.tsx
index eaede783da1..052d71e5829 100644
--- a/web/app/(shareLayout)/components/splash.tsx
+++ b/web/app/(shareLayout)/components/splash.tsx
@@ -8,7 +8,7 @@ import {
resolveWebAppLoginRedirect,
} from '@/app/(shareLayout)/webapp-signin/login-redirect'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useWebAppStore } from '@/context/web-app-context'
import { AccessMode } from '@/models/access-control'
import { usePathname, useRouter, useSearchParams } from '@/next/navigation'
@@ -176,7 +176,7 @@ function Splash({ children }: PropsWithChildren) {
if (isLoading) {
return (
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx
index 49b2d932f0f..b72d3fb3fcb 100644
--- a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx
+++ b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx
@@ -6,7 +6,7 @@ import * as React from 'react'
import { useCallback, useEffect } from 'react'
import { resolveWebAppLoginRedirect } from '@/app/(shareLayout)/webapp-signin/login-redirect'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { useRouter, useSearchParams } from '@/next/navigation'
import { fetchWebOAuth2SSOUrl, fetchWebOIDCSSOUrl, fetchWebSAMLSSOUrl } from '@/service/share'
@@ -69,7 +69,7 @@ const ExternalMemberSSOAuth = () => {
return (
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/(shareLayout)/webapp-signin/normalForm.tsx b/web/app/(shareLayout)/webapp-signin/normalForm.tsx
index bfa8906f023..a6c2cd83e8c 100644
--- a/web/app/(shareLayout)/webapp-signin/normalForm.tsx
+++ b/web/app/(shareLayout)/webapp-signin/normalForm.tsx
@@ -6,7 +6,7 @@ import { useSuspenseQuery } from '@tanstack/react-query'
import * as React from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import Link from '@/next/link'
import MailAndCodeAuth from './components/mail-and-code-auth'
@@ -55,7 +55,7 @@ const NormalForm = () => {
<div
className={cn('flex w-full grow flex-col items-center justify-center', 'px-6', 'md:px-27')}
>
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx
index e0a3dc00994..44868ffa39e 100644
--- a/web/app/(shareLayout)/webapp-signin/page.tsx
+++ b/web/app/(shareLayout)/webapp-signin/page.tsx
@@ -4,7 +4,7 @@ import * as React from 'react'
import { useCallback, useEffect, useSyncExternalStore } from 'react'
import { useTranslation } from 'react-i18next'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useWebAppStore } from '@/context/web-app-context'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { AccessMode } from '@/models/access-control'
@@ -54,7 +54,7 @@ function WebSSOForm() {
if (!loginRedirect) {
return (
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/account/oauth/authorize/page.tsx b/web/app/account/oauth/authorize/page.tsx
index bbdf7f76188..410aff077c2 100644
--- a/web/app/account/oauth/authorize/page.tsx
+++ b/web/app/account/oauth/authorize/page.tsx
@@ -14,7 +14,7 @@ import {
import { skipToken, useMutation, useQuery } from '@tanstack/react-query'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { isLegacyBase401, userProfileQueryOptions } from '@/features/account-profile/client'
import useDocumentTitle from '@/hooks/use-document-title'
@@ -161,7 +161,7 @@ export default function OAuthAuthorize() {
if (isProfileLoading || isOAuthLoading || isAutoAuthorizing) {
return (
<div className="bg-background-default-subtle">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
diff --git a/web/app/activate/activateForm.tsx b/web/app/activate/activateForm.tsx
index 188bc2c5a8a..f60dcf727c9 100644
--- a/web/app/activate/activateForm.tsx
+++ b/web/app/activate/activateForm.tsx
@@ -3,7 +3,7 @@ import { buttonVariants } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useDocumentTitle from '@/hooks/use-document-title'
import { useRouter, useSearchParams } from '@/next/navigation'
import { useInvitationCheck } from '@/service/use-common'
@@ -52,7 +52,7 @@ const ActivateForm = () => {
<div
className={cn('flex w-full grow flex-col items-center justify-center', 'px-6', 'md:px-27')}
>
- {!checkRes && <Loading />}
+ {!checkRes && <LoadingPlaceholder />}
{checkRes && !checkRes.is_valid && (
<div className="flex flex-col md:w-100">
<div className="mx-auto w-full">
diff --git a/web/app/components/access-rules-editor/__tests__/index.spec.tsx b/web/app/components/access-rules-editor/__tests__/index.spec.tsx
index 4a6b498ece5..eed342ae46d 100644
--- a/web/app/components/access-rules-editor/__tests__/index.spec.tsx
+++ b/web/app/components/access-rules-editor/__tests__/index.spec.tsx
@@ -109,7 +109,7 @@ describe('AccessRulesEditor', () => {
/>,
)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByText('permission.accessRule.noUserAccessSettings')).not.toBeInTheDocument()
})
diff --git a/web/app/components/access-rules-editor/add-access-subject-popover.tsx b/web/app/components/access-rules-editor/add-access-subject-popover.tsx
index 3175f1fd500..57a541a9bec 100644
--- a/web/app/components/access-rules-editor/add-access-subject-popover.tsx
+++ b/web/app/components/access-rules-editor/add-access-subject-popover.tsx
@@ -8,7 +8,7 @@ import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '@langgeni
import { useQuery } from '@tanstack/react-query'
import { memo, useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { consoleQuery } from '@/service/console'
import { DEFAULT_ACCESS_POLICY_ID } from './constants'
@@ -93,9 +93,7 @@ function AddAccessSubjectPopoverContent({
</Button>
</div>
) : isLoading ? (
- <div className="flex h-20 items-center justify-center p-1">
- <Loading type="app" />
- </div>
+ <LoadingPlaceholder className="h-20 p-1" />
) : availableMembers.length === 0 ? (
<div className="px-3 py-6 text-center system-xs-regular text-text-tertiary">
{t(($) => $['accessRule.noAvailableMembers'], { ns: 'permission' })}
diff --git a/web/app/components/access-rules-editor/index.tsx b/web/app/components/access-rules-editor/index.tsx
index 1810c04da43..d37efe99048 100644
--- a/web/app/components/access-rules-editor/index.tsx
+++ b/web/app/components/access-rules-editor/index.tsx
@@ -10,7 +10,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import { Pagination } from '@langgenius/dify-ui/pagination'
import { memo, useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { RESOURCE_ACCESS_SETTINGS_PAGE_SIZE_OPTIONS } from '@/service/access-control/constants'
import AddAccessSubjectPopover from './add-access-subject-popover'
import AutomaticIncludeWorkspaceMembersSection from './automatic-include-workspace-members-section'
@@ -303,7 +303,7 @@ function AccessRulesEditor({
colSpan={3}
className="flex flex-1 items-center justify-center px-4 py-8 text-center"
>
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</td>
</tr>
) : userAccessSettings.length === 0 ? (
diff --git a/web/app/components/api-key/api-key-modal.tsx b/web/app/components/api-key/api-key-modal.tsx
index d9cabd605f2..99884146aef 100644
--- a/web/app/components/api-key/api-key-modal.tsx
+++ b/web/app/components/api-key/api-key-modal.tsx
@@ -22,7 +22,7 @@ import { skipToken, useMutation, useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { currentWorkspaceAtom } from '@/context/workspace-state'
import { consoleQuery } from '@/service/console'
import { ApiKeyTable } from './api-key-table'
@@ -211,7 +211,7 @@ export function ApiKeyModal({ open, canManage, scope, onOpenChange }: ApiKeyModa
/>
{isLoading && (
<div className="flex min-h-24 items-center border-y border-divider-subtle px-6">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{!!apiKeys?.length && (
diff --git a/web/app/components/app/access-point/built-in-access-points/index.tsx b/web/app/components/app/access-point/built-in-access-points/index.tsx
index 1713f41cdbd..cc48a5af3f0 100644
--- a/web/app/components/app/access-point/built-in-access-points/index.tsx
+++ b/web/app/components/app/access-point/built-in-access-points/index.tsx
@@ -6,7 +6,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import { useStore as useAppStore } from '@/app/components/app/store'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDocLink } from '@/context/i18n'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import Link from '@/next/link'
@@ -51,7 +51,7 @@ export function BuiltInAccessPoints({
})
const actions = useAccessPointActions(appId, canManageAccessPoint)
- if (!appInfo) return <Loading />
+ if (!appInfo) return <LoadingPlaceholder />
const workflowState = getPublishedWorkflowState(appInfo, workflow)
const builtInLoading = workflowState.isWorkflowApp && workflowLoading
diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx
index 6a3297f7b2a..1d41e9cec7e 100644
--- a/web/app/components/app/annotation/index.tsx
+++ b/web/app/components/app/annotation/index.tsx
@@ -18,7 +18,7 @@ import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import ConfigParamModal from '@/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal'
import { MessageFast } from '@/app/components/base/icons/src/vender/solid/communication'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import AnnotationFullModal from '@/app/components/billing/annotation-full/modal'
import { APP_PAGE_LIMIT } from '@/config'
import { useDocLink } from '@/context/i18n'
@@ -248,7 +248,7 @@ const Annotation: FC<Props> = (props) => {
</div>
</Filter>
{isLoading ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : total > 0 ? (
<List
list={list}
diff --git a/web/app/components/app/app-access-control/__tests__/add-member-or-group-pop.spec.tsx b/web/app/components/app/app-access-control/__tests__/add-member-or-group-pop.spec.tsx
index 688ea7212fa..b39b3387084 100644
--- a/web/app/components/app/app-access-control/__tests__/add-member-or-group-pop.spec.tsx
+++ b/web/app/components/app/app-access-control/__tests__/add-member-or-group-pop.spec.tsx
@@ -177,6 +177,27 @@ describe('AddMemberOrGroupDialog', () => {
)
})
+ it('keeps member-search loading text in its existing live region', async () => {
+ const query = {
+ isLoading: true,
+ isFetchingNextPage: false,
+ fetchNextPage: vi.fn(),
+ data: { pages: [] },
+ }
+ mockUseSearchForWhiteListCandidates.mockReturnValue(query)
+ const user = userEvent.setup()
+ const view = render(<ControlledDialog />)
+ await user.click(screen.getByText('common.operation.add'))
+ const status = screen.getByRole('status')
+ expect(status).toHaveTextContent('common.loading')
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
+
+ mockUseSearchForWhiteListCandidates.mockReturnValue({ ...query, isLoading: false })
+ view.rerender(<ControlledDialog />)
+ expect(screen.getByRole('status')).toBe(status)
+ expect(status).toHaveTextContent('app.accessControlDialog.operateGroupAndMember.noResult')
+ })
+
it('should show the empty state when no candidates are returned', async () => {
mockUseSearchForWhiteListCandidates.mockReturnValue({
isLoading: false,
diff --git a/web/app/components/app/app-access-control/__tests__/specific-groups-or-members.spec.tsx b/web/app/components/app/app-access-control/__tests__/specific-groups-or-members.spec.tsx
index 3f15ca67169..f3a8889e552 100644
--- a/web/app/components/app/app-access-control/__tests__/specific-groups-or-members.spec.tsx
+++ b/web/app/components/app/app-access-control/__tests__/specific-groups-or-members.spec.tsx
@@ -1,5 +1,5 @@
import type { AccessControlAccount, AccessControlGroup } from '@/models/access-control'
-import { render, screen } from '@testing-library/react'
+import { render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { AccessMode } from '@/models/access-control'
import SpecificGroupsOrMembers from '../specific-groups-or-members'
@@ -67,7 +67,7 @@ describe('SpecificGroupsOrMembers', () => {
/>,
)
- expect(container.querySelector('.spin-animation')).toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).toBeInTheDocument()
expect(mockAddMemberOrGroupDialog).not.toHaveBeenCalled()
})
diff --git a/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx b/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx
index ebd3b76327a..e80cc9ce1d5 100644
--- a/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx
+++ b/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx
@@ -16,10 +16,10 @@ import {
ScrollAreaThumb,
ScrollAreaViewport,
} from '@langgenius/dify-ui/scroll-area'
+import { SpinnerIcon } from '@langgenius/dify-ui/spinner'
import { useDebounce } from 'ahooks'
import { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
import { SearchInput } from '@/app/components/base/search-input'
import { SubjectType } from '@/models/access-control'
import { useSearchForWhiteListCandidates } from '@/service/access-control'
@@ -188,14 +188,24 @@ export default function AddMemberOrGroupDialog({
}
>
{isLoading ? (
- <div className="w-full" aria-hidden="true">
- <Loading />
- </div>
+ <>
+ <SpinnerIcon />
+ <span className="sr-only">{t(($) => $.loading, { ns: 'common' })}</span>
+ </>
) : (
- statusText
+ <>
+ {statusText}
+ {isFetchingNextPage && (
+ <span className="sr-only">{t(($) => $.loading, { ns: 'common' })}</span>
+ )}
+ </>
)}
</div>
- {isFetchingNextPage && <Loading />}
+ {isFetchingNextPage && (
+ <div className="flex w-full justify-center">
+ <SpinnerIcon />
+ </div>
+ )}
<div ref={anchorRef} className="h-0" />
</ScrollAreaContent>
</ScrollAreaViewport>
diff --git a/web/app/components/app/app-access-control/specific-groups-or-members.tsx b/web/app/components/app/app-access-control/specific-groups-or-members.tsx
index 8259a83d2f0..cb8a70aaf74 100644
--- a/web/app/components/app/app-access-control/specific-groups-or-members.tsx
+++ b/web/app/components/app/app-access-control/specific-groups-or-members.tsx
@@ -4,9 +4,9 @@ import { Avatar } from '@langgenius/dify-ui/avatar'
import { Button } from '@langgenius/dify-ui/button'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { AccessMode } from '@/models/access-control'
import { Infotip } from '../../base/infotip'
-import Loading from '../../base/loading'
import AddMemberOrGroupDialog from './add-member-or-group-pop'
export type AccessControlSubjects = {
@@ -63,7 +63,7 @@ export default function SpecificGroupsOrMembers({
</div>
<div className="px-1 pb-1">
<div className="flex max-h-100 flex-col gap-y-2 overflow-y-auto rounded-lg bg-background-section p-2">
- {subjectsStatus === 'loading' && <Loading />}
+ {subjectsStatus === 'loading' && <LoadingPlaceholder />}
{subjectsStatus === 'error' && (
<div role="alert" className="flex flex-col items-center gap-2 px-2 py-5">
<p className="system-xs-regular text-text-tertiary">
diff --git a/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx b/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx
index 96642b8c1fe..56ba2f05db8 100644
--- a/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx
+++ b/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx
@@ -489,7 +489,7 @@ describe('PublisherEnvironmentFlow', () => {
)
expect(screen.getByText('Environment tabs')).toBeInTheDocument()
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
})
it('formats deployed_at as a Unix timestamp in seconds', () => {
diff --git a/web/app/components/app/app-publisher/__tests__/index.spec.tsx b/web/app/components/app/app-publisher/__tests__/index.spec.tsx
index 8b1ec64b24a..3e9bbb4781f 100644
--- a/web/app/components/app/app-publisher/__tests__/index.spec.tsx
+++ b/web/app/components/app/app-publisher/__tests__/index.spec.tsx
@@ -632,7 +632,7 @@ describe('AppPublisher', () => {
expect(environmentDeploymentListRequests.length).toBeGreaterThan(0)
})
expect(environmentDeploymentDetailRequests).toHaveLength(0)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByText(/studio\.accessPoint\.noPublishedTitle/)).not.toBeInTheDocument()
expect(screen.queryByText(/studio\.publisher\.notDeployedYet/)).not.toBeInTheDocument()
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
index 4916eb37320..9a0328e297a 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
@@ -6,7 +6,7 @@ import type { DeploymentVersion } from '@/app/components/app/deploy/utils/versio
import { useAtomValue, useSetAtom } from 'jotai'
import { useTranslation } from 'react-i18next'
import { EnvironmentDeploymentFlow } from '@/app/components/app/deploy/shared/environment-deployment-flow'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
publisherEnvironmentDeploymentPollingAtom,
startPublisherEnvironmentDeploymentPollingAtom,
@@ -52,7 +52,7 @@ export function PublisherEnvironmentFlow({
<div aria-busy={isDeploymentLoading} className="flex min-h-40 flex-col gap-3 p-4">
{environmentTabs}
{isDeploymentLoading ? (
- <Loading className="flex-1" />
+ <LoadingPlaceholder className="flex-1" />
) : (
<div
role="alert"
diff --git a/web/app/components/app/configuration/__tests__/configuration-view.spec.tsx b/web/app/components/app/configuration/__tests__/configuration-view.spec.tsx
index a39b86d0a2a..933bf01b86b 100644
--- a/web/app/components/app/configuration/__tests__/configuration-view.spec.tsx
+++ b/web/app/components/app/configuration/__tests__/configuration-view.spec.tsx
@@ -323,7 +323,7 @@ describe('ConfigurationView', () => {
it('should render a loading state before configuration data is ready', () => {
render(<ConfigurationView {...createViewModel({ showLoading: true })} />)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByTestId('app-publisher')).not.toBeInTheDocument()
})
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
index d907e9e106f..c3677f3f102 100644
--- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
@@ -18,7 +18,7 @@ import * as React from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import TabSlider from '@/app/components/base/tab-slider-plain'
import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form'
import Icon from '@/app/components/plugins/card/base/card-icon'
@@ -183,7 +183,7 @@ const SettingBuiltInTool: FC<Props> = ({
)}
>
<DrawerContent className="flex min-h-0 flex-1 flex-col p-0 pb-0">
- {isLoading && <Loading type="app" />}
+ {isLoading && <LoadingPlaceholder className="h-full" />}
{!isLoading && (
<>
{/* header */}
diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
index 901733e32e0..2f2eb685346 100644
--- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
+++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
@@ -21,7 +21,7 @@ import * as React from 'react'
import { useCallback, useId, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from '@/app/components/app/configuration/toast'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
@@ -190,7 +190,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
const renderLoading = (
<div className="flex min-w-0 flex-col items-center justify-center space-y-3 xl:h-full xl:flex-1">
- <Loading />
+ <LoadingPlaceholder />
<div className="text-[13px] text-text-tertiary">
{t(($) => $['generate.loading'], { ns: 'appDebug' })}
</div>
diff --git a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
index ce0a57b76d9..06d905d85fd 100644
--- a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
+++ b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
@@ -20,7 +20,7 @@ import * as React from 'react'
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from '@/app/components/app/configuration/toast'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
@@ -189,7 +189,7 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = ({
const renderLoading = (
<div className="flex h-full w-0 grow flex-col items-center justify-center space-y-3">
- <Loading />
+ <LoadingPlaceholder />
<div className="text-[13px] text-text-tertiary">
{t(($) => $['codegen.loading'], { ns: 'appDebug' })}
</div>
diff --git a/web/app/components/app/configuration/configuration-view/index.tsx b/web/app/components/app/configuration/configuration-view/index.tsx
index c94e9a01181..5ffa311e8c2 100644
--- a/web/app/components/app/configuration/configuration-view/index.tsx
+++ b/web/app/components/app/configuration/configuration-view/index.tsx
@@ -34,7 +34,7 @@ import Debug from '@/app/components/app/configuration/debug'
import Divider from '@/app/components/base/divider'
import { FeaturesProvider } from '@/app/components/base/features'
import NewFeaturePanel from '@/app/components/base/features/new-feature-panel'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
import PluginDependency from '@/app/components/workflow/plugin-dependency'
import ConfigContext from '@/context/debug-configuration'
@@ -101,7 +101,7 @@ const ConfigurationView: FC<ConfigurationViewModel> = ({
if (showLoading) {
return (
<div className="flex h-full items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
index 1e9b0037371..48e7a67e705 100644
--- a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
@@ -12,7 +12,7 @@ import { useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import AppIcon from '@/app/components/base/app-icon'
import Badge from '@/app/components/base/badge'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import FeatureIcon from '@/app/components/header/account-setting/model-provider-page/model-selector/feature-icon'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
@@ -118,7 +118,7 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
/>
{isLoading && datasets.length === 0 && (
<div className="flex h-50">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)}
@@ -201,7 +201,7 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
)}
</button>
))}
- {isFetchingNextPage && <Loading />}
+ {isFetchingNextPage && <LoadingPlaceholder />}
</div>
</>
)}
diff --git a/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx b/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx
index 4c36c5d6990..773b5fad799 100644
--- a/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx
+++ b/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx
@@ -415,7 +415,7 @@ describe('Apps', () => {
render(<Apps onClose={vi.fn()} />)
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar'))!.toBeInTheDocument()
})
it('should handle an undefined template payload by falling back to the empty state', () => {
diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx
index 691a97eac43..a3915247047 100644
--- a/web/app/components/app/create-app-dialog/app-list/index.tsx
+++ b/web/app/components/app/create-app-dialog/app-list/index.tsx
@@ -14,7 +14,7 @@ import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import AppTypeSelector from '@/app/components/app/type-selector'
import Divider from '@/app/components/base/divider'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import CreateAppModal from '@/app/components/explore/create-app-modal'
import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
@@ -171,7 +171,7 @@ const Apps = ({ onClose, onCreateFromBlank }: AppsProps) => {
if (isLoading) {
return (
<div className="flex h-full items-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/app/deploy/__tests__/index.spec.tsx b/web/app/components/app/deploy/__tests__/index.spec.tsx
index e2738af56ad..4df3f221db9 100644
--- a/web/app/components/app/deploy/__tests__/index.spec.tsx
+++ b/web/app/components/app/deploy/__tests__/index.spec.tsx
@@ -1112,7 +1112,7 @@ describe('AppDeploy', () => {
render(<AppDeploy />)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(
screen.queryByRole('heading', { name: 'common.appMenus.deploy' }),
).not.toBeInTheDocument()
@@ -2123,7 +2123,7 @@ describe('AppDeploy', () => {
{ queryClient },
)
- expect(screen.getByRole('status', { name: /loading/ })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: /loading/ })).toBeInTheDocument()
expect(screen.queryByRole('table')).not.toBeInTheDocument()
await waitFor(() => {
expect(deploymentRequests).toHaveLength(1)
diff --git a/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx b/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx
index 7c9c17e6cf9..74af3c9af76 100644
--- a/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx
+++ b/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx
@@ -12,7 +12,7 @@ import {
} from '@langgenius/dify-ui/dropdown-menu'
import { useAtomValue } from 'jotai'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
appEnvironmentsIsErrorAtom,
appEnvironmentsIsLoadingAtom,
@@ -62,7 +62,7 @@ export function EnvironmentDeployMenu({
{t(($) => $['card.notDeployed'])}
</DropdownMenuLabel>
{isLoading ? (
- <Loading className="h-7" />
+ <LoadingPlaceholder className="h-7" />
) : isError ? (
<div className="flex flex-col items-center">
<p role="alert" className="px-2 py-1.5 system-xs-regular text-text-destructive">
diff --git a/web/app/components/app/deploy/environment-table/index.tsx b/web/app/components/app/deploy/environment-table/index.tsx
index 28230e6b857..79a12a105dd 100644
--- a/web/app/components/app/deploy/environment-table/index.tsx
+++ b/web/app/components/app/deploy/environment-table/index.tsx
@@ -11,7 +11,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import { useAtomValue } from 'jotai'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
appEnvironmentDeploymentsAtom,
appEnvironmentDeploymentsIsErrorAtom,
@@ -167,7 +167,7 @@ export const EnvironmentTable = memo(
)}
>
{showLoadingState ? (
- <Loading className="h-full" />
+ <LoadingPlaceholder className="h-full" />
) : showErrorState ? (
<EnvironmentTableEmpty
state="error"
diff --git a/web/app/components/app/deploy/index.tsx b/web/app/components/app/deploy/index.tsx
index 2b880fd54cf..5ab81fa74dc 100644
--- a/web/app/components/app/deploy/index.tsx
+++ b/web/app/components/app/deploy/index.tsx
@@ -12,7 +12,7 @@ import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
import { useStore as useAppStore } from '@/app/components/app/store'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { getEnterpriseDocUrl } from '@/context/i18n'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { userProfileQueryOptions } from '@/features/account-profile/client'
@@ -161,7 +161,7 @@ export default function AppDeploy() {
})
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
- if (!appDetail) return <Loading type="app" />
+ if (!appDetail) return <LoadingPlaceholder className="h-full" />
const { canDeploy, canViewAccessPoint } = getAppACLCapabilities(appDetail.permission_keys, {
currentUserId,
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/content.tsx b/web/app/components/app/deploy/shared/deployment-configuration/content.tsx
index 1a725c9ce15..adc3d5cf10f 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/content.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/content.tsx
@@ -6,7 +6,7 @@ import type { DeploymentConfigurationQueryState } from './use-deployment-configu
import type { DeploymentConfigurationValuesController } from './use-deployment-configuration-values'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { CredentialsSection } from './credentials-section'
import { DeploymentPrecheckAlert } from './deployment-precheck-alert'
import { EnvironmentVariablesSection } from './environment-variables-section'
@@ -99,7 +99,7 @@ export function DeploymentConfigurationContent({
aria-busy={isPrechecking || isLoadingDeploymentOptions}
className="min-h-0 flex-1 overflow-y-auto"
>
- {isPrechecking && <Loading className="py-8" />}
+ {isPrechecking && <LoadingPlaceholder className="py-8" />}
{!isPrechecking && precheckError && (
<div className={cn('py-4', horizontalPaddingClassName)}>
<ConfigurationError
@@ -114,7 +114,7 @@ export function DeploymentConfigurationContent({
<DeploymentPrecheckAlert nodes={unsupportedNodes} />
</div>
)}
- {isLoadingDeploymentOptions && <Loading className="py-8" />}
+ {isLoadingDeploymentOptions && <LoadingPlaceholder className="py-8" />}
{!isLoadingDeploymentOptions && deploymentOptionsError && (
<div className={cn('py-4', horizontalPaddingClassName)}>
<ConfigurationError
diff --git a/web/app/components/app/deploy/shared/version-selection/version-list.tsx b/web/app/components/app/deploy/shared/version-selection/version-list.tsx
index 3d2f12c1006..7226de85d54 100644
--- a/web/app/components/app/deploy/shared/version-selection/version-list.tsx
+++ b/web/app/components/app/deploy/shared/version-selection/version-list.tsx
@@ -12,7 +12,7 @@ import {
import { useAtomValue } from 'jotai'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
import Link from '@/next/link'
import {
@@ -179,7 +179,7 @@ export function VersionList({
versions={versions}
/>
</div>
- {isLoading && <Loading type="app" />}
+ {isLoading && <LoadingPlaceholder className="h-full" />}
{!isLoading && versionsError && versions.length === 0 && (
<div className="flex h-full flex-col items-center justify-center px-2 py-6">
<p role="alert" className="text-center system-xs-regular text-text-tertiary">
@@ -203,7 +203,7 @@ export function VersionList({
)}
</div>
)}
- {isFetchingNextPage && versions.length > 0 && <Loading className="h-8" />}
+ {isFetchingNextPage && versions.length > 0 && <LoadingPlaceholder className="h-8" />}
<div ref={sentinelRef} aria-hidden className="h-px" />
</ScrollAreaContent>
</ScrollAreaViewport>
diff --git a/web/app/components/app/log-annotation/__tests__/index.spec.tsx b/web/app/components/app/log-annotation/__tests__/index.spec.tsx
index 3e810948d05..d5f46445e6d 100644
--- a/web/app/components/app/log-annotation/__tests__/index.spec.tsx
+++ b/web/app/components/app/log-annotation/__tests__/index.spec.tsx
@@ -69,7 +69,7 @@ describe('LogAnnotation', () => {
render(<LogAnnotation pageType={PageType.log} />)
// Assert
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should render log content without the old page tabs', () => {
diff --git a/web/app/components/app/log-annotation/index.tsx b/web/app/components/app/log-annotation/index.tsx
index fe9eb4b45b0..37c0115fe76 100644
--- a/web/app/components/app/log-annotation/index.tsx
+++ b/web/app/components/app/log-annotation/index.tsx
@@ -6,7 +6,7 @@ import Log from '@/app/components/app/log'
import { useStore as useAppStore } from '@/app/components/app/store'
import WorkflowLog from '@/app/components/app/workflow-log'
import { PageType } from '@/app/components/base/features/new-feature-panel/annotation-reply/type'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { AppModeEnum } from '@/types/app'
type Props = Readonly<{
@@ -19,7 +19,7 @@ const LogAnnotation: FC<Props> = ({ pageType }) => {
if (!appDetail) {
return (
<div className="flex h-full items-center justify-center bg-background-body">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/app/log/__tests__/index.spec.tsx b/web/app/components/app/log/__tests__/index.spec.tsx
index 292818a2f75..99f9894307c 100644
--- a/web/app/components/app/log/__tests__/index.spec.tsx
+++ b/web/app/components/app/log/__tests__/index.spec.tsx
@@ -69,8 +69,8 @@ vi.mock('../retention-upgrade-notice', () => ({
RetentionUpgradeNotice: () => <div>retention-upgrade-notice</div>,
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div>loading-logs</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div>loading-logs</div>,
}))
describe('Logs', () => {
diff --git a/web/app/components/app/log/__tests__/list.spec.tsx b/web/app/components/app/log/__tests__/list.spec.tsx
index 9951ce6b4ea..1f852a65f92 100644
--- a/web/app/components/app/log/__tests__/list.spec.tsx
+++ b/web/app/components/app/log/__tests__/list.spec.tsx
@@ -74,8 +74,8 @@ vi.mock('@/app/components/app/store', () => ({
}),
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div>loading</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div>loading</div>,
}))
vi.mock('@/app/components/app/log/model-info', () => ({
diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx
index 0c91182754d..949c1fa4582 100644
--- a/web/app/components/app/log/index.tsx
+++ b/web/app/components/app/log/index.tsx
@@ -8,7 +8,7 @@ import { omit } from 'es-toolkit/object'
import * as React from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { APP_PAGE_LIMIT } from '@/config'
import { useDocLink } from '@/context/i18n'
import { usePathname, useRouter, useSearchParams } from '@/next/navigation'
@@ -163,7 +163,7 @@ const Logs: FC<ILogsProps> = ({ appDetail }) => {
/>
<RetentionUpgradeNotice />
{total === undefined ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : total > 0 ? (
<List
logs={isChatMode ? chatConversations : completionConversations}
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx
index 4492651676c..758229d009e 100644
--- a/web/app/components/app/log/list.tsx
+++ b/web/app/components/app/log/list.tsx
@@ -49,7 +49,7 @@ import TextGeneration from '@/app/components/app/text-generate/item'
import AgentLogModal from '@/app/components/base/agent-log-modal'
import Chat from '@/app/components/base/chat/chat'
import CopyIcon from '@/app/components/base/copy-icon'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import MessageLogModal from '@/app/components/base/message-log-modal'
import { WorkflowContextProvider } from '@/app/components/workflow/context'
import { userProfileQueryOptions } from '@/features/account-profile/client'
@@ -922,7 +922,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
)
}
- if (!logs) return <Loading />
+ if (!logs) return <LoadingPlaceholder />
return (
<div className="relative mt-2 grow overflow-x-auto">
diff --git a/web/app/components/app/overview/app-chart.tsx b/web/app/components/app/overview/app-chart.tsx
index fea3a1fc7e1..bac89c0a340 100644
--- a/web/app/components/app/overview/app-chart.tsx
+++ b/web/app/components/app/overview/app-chart.tsx
@@ -9,7 +9,7 @@ import ReactECharts from 'echarts-for-react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { Infotip } from '@/app/components/base/infotip'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { consoleQuery } from '@/service/console'
import {
buildChartOptions,
@@ -199,7 +199,7 @@ const createBizChartComponent = <TData extends ChartResponse>({
const { t } = useTranslation()
const { data: response, isLoading } = useQuery(queryOptions(id, period.query))
- if (isLoading || !response) return <Loading />
+ if (isLoading || !response) return <LoadingPlaceholder />
const noDataFlag = !response.data || response.data.length === 0
const fallbackKey = emptyValueKey ?? valueKey
diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsx
index 04bb1cd36d9..da2c0683474 100644
--- a/web/app/components/app/text-generate/item/index.tsx
+++ b/web/app/components/app/text-generate/item/index.tsx
@@ -13,7 +13,7 @@ import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore as useAppStore } from '@/app/components/app/store'
import { useChatContext } from '@/app/components/base/chat/chat/context'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { Markdown } from '@/app/components/base/markdown'
import { useParams } from '@/next/navigation'
import { fetchTextGenerationMessage } from '@/service/debug'
@@ -205,7 +205,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
!inSidePanel && 'rounded-2xl border-t border-divider-subtle bg-chat-bubble-bg',
)}
>
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)}
{!isLoading && (
diff --git a/web/app/components/app/workflow-log/__tests__/index.spec.tsx b/web/app/components/app/workflow-log/__tests__/index.spec.tsx
index 748937e571e..5d16f110874 100644
--- a/web/app/components/app/workflow-log/__tests__/index.spec.tsx
+++ b/web/app/components/app/workflow-log/__tests__/index.spec.tsx
@@ -19,7 +19,7 @@ import type { CloudSandboxPlanState } from '../../log/cloud-sandbox-retention'
import type { ILogsProps } from '../index'
import type { WorkflowAppLogDetail, WorkflowLogsResponse, WorkflowRunDetail } from '@/models/log'
import type { App, AppIconType, AppModeEnum } from '@/types/app'
-import { screen, waitFor } from '@testing-library/react'
+import { screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import dayjs from 'dayjs'
import { APP_PAGE_LIMIT } from '@/config'
@@ -322,7 +322,7 @@ describe('Logs Container', () => {
const { container } = renderWithQueryClient(<Logs {...defaultProps} />)
// Assert
- expect(container.querySelector('.spin-animation')).toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).toBeInTheDocument()
})
it('should not show loading spinner when data is available', () => {
@@ -337,7 +337,7 @@ describe('Logs Container', () => {
const { container } = renderWithQueryClient(<Logs {...defaultProps} />)
// Assert
- expect(container.querySelector('.spin-animation')).not.toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).not.toBeInTheDocument()
})
})
@@ -653,7 +653,7 @@ describe('Logs Container', () => {
const { container } = renderWithQueryClient(<Logs {...defaultProps} />)
// Assert - should show loading state when data is undefined
- expect(container.querySelector('.spin-animation')).toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).toBeInTheDocument()
})
it('should handle app with different ID', () => {
diff --git a/web/app/components/app/workflow-log/__tests__/list.spec.tsx b/web/app/components/app/workflow-log/__tests__/list.spec.tsx
index 97bfb832fa0..03ec70b414a 100644
--- a/web/app/components/app/workflow-log/__tests__/list.spec.tsx
+++ b/web/app/components/app/workflow-log/__tests__/list.spec.tsx
@@ -11,7 +11,7 @@
import type { WorkflowAppLogDetail, WorkflowLogsResponse, WorkflowRunDetail } from '@/models/log'
import type { App, AppIconType, AppModeEnum } from '@/types/app'
-import { render, screen, waitFor } from '@testing-library/react'
+import { render, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { useStore as useAppStore } from '@/app/components/app/store'
import { APP_PAGE_LIMIT } from '@/config'
@@ -186,7 +186,7 @@ describe('WorkflowAppLogList', () => {
/>,
)
- expect(container.querySelector('.spin-animation'))!.toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar'))!.toBeInTheDocument()
})
it('should render loading state when appDetail is undefined', () => {
@@ -196,7 +196,7 @@ describe('WorkflowAppLogList', () => {
<WorkflowAppLogList logs={logs} appDetail={undefined} onRefresh={defaultOnRefresh} />,
)
- expect(container.querySelector('.spin-animation'))!.toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar'))!.toBeInTheDocument()
})
it('should render table when data is available', () => {
diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsx
index 7ec0bfb46dc..650825c5c86 100644
--- a/web/app/components/app/workflow-log/index.tsx
+++ b/web/app/components/app/workflow-log/index.tsx
@@ -12,7 +12,7 @@ import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import EmptyElement from '@/app/components/app/log/empty-element'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { APP_PAGE_LIMIT } from '@/config'
import { userProfileQueryOptions } from '@/features/account-profile/client'
import { useWorkflowLogs } from '@/service/use-log'
@@ -103,7 +103,7 @@ const Logs: FC<ILogsProps> = ({ appDetail }) => {
{showArchivedLogsNotice && <ArchivedLogsNotice />}
{/* workflow log */}
{total === undefined ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : total > 0 ? (
<List logs={workflowLogs} appDetail={appDetail} onRefresh={mutate} />
) : (
diff --git a/web/app/components/app/workflow-log/list.tsx b/web/app/components/app/workflow-log/list.tsx
index 9bfd55cde99..97b6464de12 100644
--- a/web/app/components/app/workflow-log/list.tsx
+++ b/web/app/components/app/workflow-log/list.tsx
@@ -21,7 +21,7 @@ import { StatusDot } from '@langgenius/dify-ui/status-dot'
import * as React from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import useTimestamp from '@/hooks/use-timestamp'
import { AppModeEnum } from '@/types/app'
@@ -125,7 +125,7 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
setCurrentLog(undefined)
}
- if (!logs || !appDetail) return <Loading />
+ if (!logs || !appDetail) return <LoadingPlaceholder />
return (
<div className="overflow-x-auto">
diff --git a/web/app/components/base/agent-log-modal/__tests__/detail.spec.tsx b/web/app/components/base/agent-log-modal/__tests__/detail.spec.tsx
index 7df22d0997f..fe52d3d9e06 100644
--- a/web/app/components/base/agent-log-modal/__tests__/detail.spec.tsx
+++ b/web/app/components/base/agent-log-modal/__tests__/detail.spec.tsx
@@ -134,7 +134,7 @@ describe('AgentLogDetail', () => {
) => {
const result = renderComponent(props)
await waitFor(() => {
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
})
return result
}
@@ -149,7 +149,7 @@ describe('AgentLogDetail', () => {
renderComponent()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should display result panel after data loads', async () => {
@@ -245,7 +245,7 @@ describe('AgentLogDetail', () => {
await waitFor(() => {
expect(fetchAgentLogDetail).not.toHaveBeenCalled()
})
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should notify on API error', async () => {
@@ -264,7 +264,7 @@ describe('AgentLogDetail', () => {
renderComponent()
await waitFor(() => {
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
})
})
diff --git a/web/app/components/base/agent-log-modal/detail.tsx b/web/app/components/base/agent-log-modal/detail.tsx
index ff61478f8f6..9e0bd43e163 100644
--- a/web/app/components/base/agent-log-modal/detail.tsx
+++ b/web/app/components/base/agent-log-modal/detail.tsx
@@ -10,7 +10,7 @@ import * as React from 'react'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore as useAppStore } from '@/app/components/app/store'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { fetchAgentLogDetail } from '@/service/log'
import ResultPanel from './result'
import TracingPanel from './tracing'
@@ -109,7 +109,7 @@ const AgentLogDetail: FC<AgentLogDetailProps> = ({
>
{loading && (
<div className="flex h-full items-center justify-center bg-components-panel-bg">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{!loading && currentTab === 'DETAIL' && runDetail && (
diff --git a/web/app/components/base/audio-btn/__tests__/index.spec.tsx b/web/app/components/base/audio-btn/__tests__/index.spec.tsx
index 07a1350f0d6..6cda0c33fbf 100644
--- a/web/app/components/base/audio-btn/__tests__/index.spec.tsx
+++ b/web/app/components/base/audio-btn/__tests__/index.spec.tsx
@@ -121,7 +121,7 @@ describe('AudioBtn', () => {
expect(mockPlayAudio).toHaveBeenCalledTimes(1)
expect(getButton())!.toBeDisabled()
})
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(getButton()).toHaveAccessibleName('loading')
await hoverAndCheckTooltip('loading')
})
diff --git a/web/app/components/base/audio-btn/index.tsx b/web/app/components/base/audio-btn/index.tsx
index 295d1c45bfd..d1288f4b84a 100644
--- a/web/app/components/base/audio-btn/index.tsx
+++ b/web/app/components/base/audio-btn/index.tsx
@@ -1,10 +1,10 @@
'use client'
import { cn } from '@langgenius/dify-ui/cn'
+import { SpinnerIcon } from '@langgenius/dify-ui/spinner'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { t } from 'i18next'
import { useState } from 'react'
import { AudioPlayerManager } from '@/app/components/base/audio-btn/audio.player.manager'
-import Loading from '@/app/components/base/loading'
import { isInstalledAppPath } from '@/app/components/explore/installed-app/routes'
import { useParams, usePathname } from '@/next/navigation'
@@ -97,7 +97,7 @@ export function AudioBtn({ id, voice, value, className, isAudition }: AudioBtnPr
>
{audioState === 'loading' ? (
<div className="flex size-full items-center justify-center rounded-md">
- <Loading />
+ <SpinnerIcon />
</div>
) : (
<div className="flex size-full items-center justify-center rounded-md hover:bg-gray-50">
diff --git a/web/app/components/base/chat/chat-with-history/index.tsx b/web/app/components/base/chat/chat-with-history/index.tsx
index 3cbb6db5aef..5792277d2fe 100644
--- a/web/app/components/base/chat/chat-with-history/index.tsx
+++ b/web/app/components/base/chat/chat-with-history/index.tsx
@@ -4,7 +4,7 @@ import type { FC } from 'react'
import type { ChatProps } from '../chat'
import { cn } from '@langgenius/dify-ui/cn'
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import useDocumentTitle from '@/hooks/use-document-title'
import { createTheme } from '../embedded-chatbot/theme/theme'
@@ -110,7 +110,7 @@ const ChatWithHistory: FC<ChatWithHistoryProps> = ({ className }) => {
{!isMobile && (
<Header toggleButtonRef={isSidebarCollapsed ? sidebarToggleRef : undefined} />
)}
- {appChatListDataLoading && <Loading type="app" />}
+ {appChatListDataLoading && <LoadingPlaceholder className="h-full" />}
{!appChatListDataLoading && <ChatWrapper key={chatShouldReloadKey} />}
</div>
</div>
diff --git a/web/app/components/base/chat/embedded-chatbot/__tests__/index.spec.tsx b/web/app/components/base/chat/embedded-chatbot/__tests__/index.spec.tsx
index 9fc5477e506..931ed7adef7 100644
--- a/web/app/components/base/chat/embedded-chatbot/__tests__/index.spec.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/__tests__/index.spec.tsx
@@ -142,7 +142,7 @@ describe('EmbeddedChatbot index', () => {
render(<EmbeddedChatbot />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
expect(screen.queryByText('chat area')).not.toBeInTheDocument()
})
diff --git a/web/app/components/base/chat/embedded-chatbot/index.tsx b/web/app/components/base/chat/embedded-chatbot/index.tsx
index 39f254dd0b8..446322be7e6 100644
--- a/web/app/components/base/chat/embedded-chatbot/index.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/index.tsx
@@ -5,7 +5,7 @@ import { useSuspenseQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper'
import Header from '@/app/components/base/chat/embedded-chatbot/header'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { DifyLogo } from '@/app/components/base/logo/dify-logo'
import LogoHeader from '@/app/components/base/logo/logo-embedded-chat-header'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
@@ -62,7 +62,7 @@ const Chatbot = () => {
isMobile && 'm-[0.5px] h-[calc(100vh-3rem)]! rounded-2xl bg-chatbot-bg',
)}
>
- {appChatListDataLoading && <Loading type="app" />}
+ {appChatListDataLoading && <LoadingPlaceholder className="h-full" />}
{!appChatListDataLoading && <ChatWrapper key={chatShouldReloadKey} />}
</div>
</div>
diff --git a/web/app/components/base/file-uploader/__tests__/pdf-preview.spec.tsx b/web/app/components/base/file-uploader/__tests__/pdf-preview.spec.tsx
index 602ae409731..674a0de18d2 100644
--- a/web/app/components/base/file-uploader/__tests__/pdf-preview.spec.tsx
+++ b/web/app/components/base/file-uploader/__tests__/pdf-preview.spec.tsx
@@ -67,7 +67,7 @@ describe('PdfPreview', () => {
expect(getScaleContainer()).not.toHaveAttribute('aria-label')
expect(screen.getByTestId('pdf-loader')).toBeInTheDocument()
expect(screen.getByTestId('pdf-highlighter')).toBeInTheDocument()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should zoom in when zoom in control is clicked', () => {
diff --git a/web/app/components/base/file-uploader/pdf-preview.tsx b/web/app/components/base/file-uploader/pdf-preview.tsx
index 3e788ef1183..beb76dbf5cb 100644
--- a/web/app/components/base/file-uploader/pdf-preview.tsx
+++ b/web/app/components/base/file-uploader/pdf-preview.tsx
@@ -6,7 +6,7 @@ import { useHotkey } from '@tanstack/react-hotkeys'
import { noop } from 'es-toolkit/function'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { PdfHighlighter, PdfLoader } from './pdf-highlighter-adapter'
@@ -69,11 +69,7 @@ const PdfPreview: FC<PdfPreviewProps> = ({ url, onCancel }) => {
<PdfLoader
workerSrc="/pdf.worker.min.mjs"
url={url}
- beforeLoad={
- <div className="flex h-64 items-center justify-center">
- <Loading type="app" />
- </div>
- }
+ beforeLoad={<LoadingPlaceholder className="h-64" />}
>
{(pdfDocument) => {
return (
diff --git a/web/app/components/base/loading-placeholder/README.md b/web/app/components/base/loading-placeholder/README.md
new file mode 100644
index 00000000000..6a0434a2088
--- /dev/null
+++ b/web/app/components/base/loading-placeholder/README.md
@@ -0,0 +1,21 @@
+# Loading placeholder
+
+`LoadingPlaceholder` replaces an unavailable content slot with a centered 16px Dify UI Spinner.
+Its root is a full-width flex container. It does not infer height: the owning page, panel, or list
+allocates the space using its existing layout. `className` applies to the placeholder container,
+never the spinner. `label` overrides the shared localized loading label.
+
+Use the existing `FullScreenLoading` for viewport-sized application states. Feature-level loading
+components own repeated feature geometry and more specific labels. When a surrounding component
+already owns the complete placement and semantics, use Spinner or SpinnerIcon directly instead of
+adding another placeholder. Buttons own their busy interaction and use decorative artwork.
+
+The placeholder does not own queries, Suspense boundaries, content persistence, `aria-busy`, or
+live announcements. The feature decides when it renders and whether a scoped skeleton is more
+appropriate. Do not add an `app`/`area` mode or map percentage height and flex growth to one `fill`
+flag: those require different containing-block contracts.
+
+During migration, preserve the actual container and artwork dimensions independently. In
+particular, a 32px placeholder still contains a 16px spinner. Preserve existing spacing, surface
+styles, scroll behavior, and loading-to-content transitions; any deliberate visible correction
+must be reviewed separately from the API replacement.
diff --git a/web/app/components/base/loading-placeholder/index.stories.tsx b/web/app/components/base/loading-placeholder/index.stories.tsx
new file mode 100644
index 00000000000..7fc2f7f932e
--- /dev/null
+++ b/web/app/components/base/loading-placeholder/index.stories.tsx
@@ -0,0 +1,30 @@
+import type { Meta, StoryObj } from '@storybook/nextjs-vite'
+import { LoadingPlaceholder } from '.'
+
+const meta = {
+ title: 'Base/Feedback/LoadingPlaceholder',
+ component: LoadingPlaceholder,
+ parameters: { layout: 'centered' },
+ args: { label: 'Loading content' },
+ tags: ['autodocs'],
+} satisfies Meta<typeof LoadingPlaceholder>
+
+export default meta
+type Story = StoryObj<typeof meta>
+
+export const ContentSlot: Story = {
+ render: (args) => <LoadingPlaceholder {...args} className="h-20 w-64" />,
+}
+
+export const RemainingSpace: Story = {
+ render: (args) => (
+ <div className="flex h-64 w-80 flex-col rounded-xl border border-divider-subtle">
+ <div className="p-4">Panel header</div>
+ <LoadingPlaceholder {...args} className="flex-1" />
+ </div>
+ ),
+}
+
+export const Pagination: Story = {
+ render: (args) => <LoadingPlaceholder {...args} className="my-3 w-64" />,
+}
diff --git a/web/app/components/base/loading-placeholder/index.tsx b/web/app/components/base/loading-placeholder/index.tsx
new file mode 100644
index 00000000000..52b7dfe6707
--- /dev/null
+++ b/web/app/components/base/loading-placeholder/index.tsx
@@ -0,0 +1,22 @@
+'use client'
+
+import { cn } from '@langgenius/dify-ui/cn'
+import { Spinner } from '@langgenius/dify-ui/spinner'
+import { useTranslation } from 'react-i18next'
+
+type LoadingPlaceholderProps = {
+ label?: string
+ className?: string
+}
+
+function LoadingPlaceholder({ label, className }: LoadingPlaceholderProps) {
+ const { t } = useTranslation()
+
+ return (
+ <div className={cn('flex w-full items-center justify-center', className)}>
+ <Spinner aria-label={label ?? t(($) => $.loading, { ns: 'appApi' })} />
+ </div>
+ )
+}
+
+export { LoadingPlaceholder }
diff --git a/web/app/components/base/loading/index.stories.tsx b/web/app/components/base/loading/index.stories.tsx
deleted file mode 100644
index bf0e29a5a06..00000000000
--- a/web/app/components/base/loading/index.stories.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import type { Meta, StoryObj } from '@storybook/nextjs-vite'
-import Loading from '.'
-
-const meta = {
- title: 'Base/Feedback/Loading',
- component: Loading,
- parameters: {
- layout: 'centered',
- docs: {
- description: {
- component:
- 'Spinner used while fetching data (`area`) or bootstrapping the full application shell (`app`).',
- },
- },
- },
- argTypes: {
- type: {
- control: 'radio',
- options: ['area', 'app'],
- },
- },
- args: {
- type: 'area',
- },
- tags: ['autodocs'],
-} satisfies Meta<typeof Loading>
-
-export default meta
-type Story = StoryObj<typeof meta>
-
-const LoadingPreview = ({ type }: { type: 'area' | 'app' }) => {
- const containerHeight = type === 'app' ? 'h-48' : 'h-20'
- const title = type === 'app' ? 'App loading state' : 'Inline loading state'
-
- return (
- <div className="flex flex-col items-center gap-4">
- <span className="text-xs tracking-[0.18em] text-text-tertiary uppercase">{title}</span>
- <div
- className={`flex w-64 items-center justify-center rounded-xl border border-divider-subtle bg-background-default-subtle ${containerHeight}`}
- >
- <Loading type={type} />
- </div>
- </div>
- )
-}
-
-export const AreaSpinner: Story = {
- render: () => <LoadingPreview type="area" />,
-}
-
-export const AppSpinner: Story = {
- render: () => <LoadingPreview type="app" />,
-}
diff --git a/web/app/components/base/loading/index.tsx b/web/app/components/base/loading/index.tsx
deleted file mode 100644
index df4e4394e25..00000000000
--- a/web/app/components/base/loading/index.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-'use client'
-
-import { cn } from '@langgenius/dify-ui/cn'
-import { useTranslation } from 'react-i18next'
-import './style.css'
-
-type ILoadingProps = Readonly<{
- type?: 'area' | 'app'
- className?: string
-}>
-
-const Loading = (props?: ILoadingProps) => {
- const { type = 'area', className } = props || {}
- const { t } = useTranslation()
-
- return (
- <div
- className={cn(
- 'flex w-full items-center justify-center',
- type === 'app' && 'h-full',
- className,
- )}
- role="status"
- aria-live="polite"
- aria-label={t(($) => $.loading, { ns: 'appApi' })}
- >
- <svg
- width="16"
- height="16"
- viewBox="0 0 16 16"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- className="spin-animation"
- >
- <g clipPath="url(#clip0_324_2488)">
- <path
- d="M15 0H10C9.44772 0 9 0.447715 9 1V6C9 6.55228 9.44772 7 10 7H15C15.5523 7 16 6.55228 16 6V1C16 0.447715 15.5523 0 15 0Z"
- fill="#1C64F2"
- />
- <path
- opacity="0.5"
- d="M15 9H10C9.44772 9 9 9.44772 9 10V15C9 15.5523 9.44772 16 10 16H15C15.5523 16 16 15.5523 16 15V10C16 9.44772 15.5523 9 15 9Z"
- fill="#1C64F2"
- />
- <path
- opacity="0.1"
- d="M6 9H1C0.447715 9 0 9.44772 0 10V15C0 15.5523 0.447715 16 1 16H6C6.55228 16 7 15.5523 7 15V10C7 9.44772 6.55228 9 6 9Z"
- fill="#1C64F2"
- />
- <path
- opacity="0.2"
- d="M6 0H1C0.447715 0 0 0.447715 0 1V6C0 6.55228 0.447715 7 1 7H6C6.55228 7 7 6.55228 7 6V1C7 0.447715 6.55228 0 6 0Z"
- fill="#1C64F2"
- />
- </g>
- <defs>
- <clipPath id="clip0_324_2488">
- <rect width="16" height="16" fill="white" />
- </clipPath>
- </defs>
- </svg>
- </div>
- )
-}
-
-export default Loading
diff --git a/web/app/components/base/loading/style.css b/web/app/components/base/loading/style.css
deleted file mode 100644
index cb6501f2913..00000000000
--- a/web/app/components/base/loading/style.css
+++ /dev/null
@@ -1,47 +0,0 @@
-.spin-animation path {
- animation: custom 2s linear infinite;
-}
-
-@keyframes custom {
- 0% {
- opacity: 0;
- }
-
- 25% {
- opacity: 0.1;
- }
-
- 50% {
- opacity: 0.2;
- }
-
- 75% {
- opacity: 0.5;
- }
-
- 100% {
- opacity: 1;
- }
-}
-
-.spin-animation path:nth-child(1) {
- animation-delay: 0s;
-}
-
-.spin-animation path:nth-child(2) {
- animation-delay: 0.5s;
-}
-
-.spin-animation path:nth-child(3) {
- animation-delay: 1s;
-}
-
-.spin-animation path:nth-child(4) {
- animation-delay: 1.5s;
-}
-
-@media (prefers-reduced-motion: reduce) {
- .spin-animation path {
- animation: none;
- }
-}
diff --git a/web/app/components/base/notion-page-selector/base.tsx b/web/app/components/base/notion-page-selector/base.tsx
index 42a10e2d9ad..4ab85546e0d 100644
--- a/web/app/components/base/notion-page-selector/base.tsx
+++ b/web/app/components/base/notion-page-selector/base.tsx
@@ -8,6 +8,7 @@ import type {
import { useQueryState } from 'nuqs'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
settingsQueryParamName,
settingsQueryParser,
@@ -17,7 +18,6 @@ import {
usePreImportNotionPages,
} from '@/service/knowledge/use-import'
import Header from '../../datasets/create/website/base/header'
-import Loading from '../loading'
import NotionConnector from '../notion-connector'
import WorkspaceSelector from './credential-selector'
import PageSelector from './page-selector'
@@ -198,7 +198,7 @@ const NotionPageSelector = ({
className="flex h-74 items-center justify-center"
data-testid="notion-page-selector-loading"
>
- <Loading />
+ <LoadingPlaceholder />
</div>
) : (
<PageSelector
diff --git a/web/app/components/billing/__tests__/query-state.spec.tsx b/web/app/components/billing/__tests__/query-state.spec.tsx
index 68571d5989b..a974749004c 100644
--- a/web/app/components/billing/__tests__/query-state.spec.tsx
+++ b/web/app/components/billing/__tests__/query-state.spec.tsx
@@ -30,7 +30,7 @@ it('reveals the plan and all usage together when both billing queries have data'
systemFeatures: { deployment_edition: 'CLOUD' },
})
render(<Billing />, { wrapper })
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByText('billing.plans.sandbox.name')).not.toBeInTheDocument()
expect(
screen.queryByRole('group', { name: 'billing.usagePage.buildApps' }),
@@ -41,7 +41,7 @@ it('reveals the plan and all usage together when both billing queries have data'
apps: { size: 17, limit: 50 },
})
})
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(
screen.queryByRole('group', { name: 'billing.usagePage.buildApps' }),
).not.toBeInTheDocument()
@@ -59,7 +59,7 @@ it('reveals the plan and all usage together when both billing queries have data'
const storage = screen.getByRole('group', { name: 'billing.usagePage.vectorSpace' })
expect(within(storage).getByText('256')).toBeInTheDocument()
expect(within(storage).getByText('900MB')).toBeInTheDocument()
- expect(screen.queryByRole('status', { name: 'appApi.loading' })).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar', { name: 'appApi.loading' })).not.toBeInTheDocument()
})
it('renders annotation usage only from returned data and preserves zero as an unlimited quota', async () => {
diff --git a/web/app/components/billing/billing-page/index.tsx b/web/app/components/billing/billing-page/index.tsx
index 0fd7a891dd3..74c0fd0eee3 100644
--- a/web/app/components/billing/billing-page/index.tsx
+++ b/web/app/components/billing/billing-page/index.tsx
@@ -5,7 +5,7 @@ import { usePrefetchQuery, useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { isCurrentWorkspaceManagerAtom } from '@/context/workspace-state'
import { deploymentEditionAtom } from '@/features/system-features/state'
import { consoleQuery } from '@/service/console'
@@ -28,7 +28,7 @@ const Billing: FC = () => {
<div className="grid min-h-132 xl:min-h-120">
<React.Suspense
fallback={
- <Loading className="rounded-2xl border-[0.5px] border-effects-highlight-lightmode-off bg-background-section-burn" />
+ <LoadingPlaceholder className="rounded-2xl border-[0.5px] border-effects-highlight-lightmode-off bg-background-section-burn" />
}
>
<PlanComp loc="billing-page" />
diff --git a/web/app/components/datasets/access-config/index.tsx b/web/app/components/datasets/access-config/index.tsx
index 73602bb9ec0..579c18c038d 100644
--- a/web/app/components/datasets/access-config/index.tsx
+++ b/web/app/components/datasets/access-config/index.tsx
@@ -7,7 +7,7 @@ import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
import AccessRulesEditor from '@/app/components/access-rules-editor'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { userProfileQueryOptions } from '@/features/account-profile/client'
@@ -219,7 +219,7 @@ const DatasetAccessConfigPage = ({ datasetId }: DatasetAccessConfigPageProps) =>
],
)
- if (!canAccessConfig) return <Loading type="app" />
+ if (!canAccessConfig) return <LoadingPlaceholder className="h-full" />
return (
<div className="flex h-full min-h-0 flex-col overflow-hidden bg-background-default-subtle">
diff --git a/web/app/components/datasets/common/document-picker/index.tsx b/web/app/components/datasets/common/document-picker/index.tsx
index 24efd211220..b9e38a49c1a 100644
--- a/web/app/components/datasets/common/document-picker/index.tsx
+++ b/web/app/components/datasets/common/document-picker/index.tsx
@@ -14,10 +14,10 @@ import {
ComboboxTrigger,
ComboboxValue,
} from '@langgenius/dify-ui/combobox'
+import { SpinnerIcon } from '@langgenius/dify-ui/spinner'
import { useDebounce } from 'ahooks'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
import { ChunkingMode } from '@/models/datasets'
import { useDocumentList } from '@/service/knowledge/use-document'
import FileIcon from '../document-file-icon'
@@ -192,8 +192,8 @@ export function DocumentPicker({ datasetId, value, parentMode, onChange }: Props
{!data && (
<>
<span className="sr-only">{t(($) => $.loading, { ns: 'common' })}</span>
- <div className="w-full" aria-hidden="true">
- <Loading />
+ <div className="flex w-full justify-center" aria-hidden="true">
+ <SpinnerIcon />
</div>
</>
)}
diff --git a/web/app/components/datasets/common/document-picker/preview-document-picker.tsx b/web/app/components/datasets/common/document-picker/preview-document-picker.tsx
index f4201df16ab..66a594e6595 100644
--- a/web/app/components/datasets/common/document-picker/preview-document-picker.tsx
+++ b/web/app/components/datasets/common/document-picker/preview-document-picker.tsx
@@ -8,7 +8,7 @@ import { useBoolean } from 'ahooks'
import * as React from 'react'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import FileIcon from '../document-file-icon'
type Props = Readonly<{
@@ -73,7 +73,7 @@ const PreviewDocumentPicker: FC<Props> = ({ className, value, files, onChange })
<PreviewDocumentList list={files} onChange={handleChange} />
) : (
<div className="mt-2 flex h-25 w-90 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx b/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx
index 16941c77053..36fd5e781fc 100644
--- a/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx
@@ -60,7 +60,7 @@ describe('ImagePreviewer', () => {
render(<ImagePreviewer images={images} onClose={vi.fn()} />)
expect(screen.getByRole('dialog')).toBeInTheDocument()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
expect(screen.getByText('Esc')).toBeInTheDocument()
})
diff --git a/web/app/components/datasets/common/image-previewer/index.tsx b/web/app/components/datasets/common/image-previewer/index.tsx
index 3701ee86b49..71336dea24d 100644
--- a/web/app/components/datasets/common/image-previewer/index.tsx
+++ b/web/app/components/datasets/common/image-previewer/index.tsx
@@ -4,7 +4,7 @@ import { Kbd } from '@langgenius/dify-ui/kbd'
import { formatForDisplay, useHotkey } from '@tanstack/react-hotkeys'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { formatFileSize } from '@/utils/format'
type CachedImage = {
@@ -168,7 +168,9 @@ const ImagePreviewer = ({ images, initialIndex = 0, onClose }: ImagePreviewerPro
</IconButton>
<Kbd>{formatForDisplay('Escape')}</Kbd>
</div>
- {cachedImages[currentImage!.url]!.status === 'loading' && <Loading type="app" />}
+ {cachedImages[currentImage!.url]!.status === 'loading' && (
+ <LoadingPlaceholder className="h-full" />
+ )}
{cachedImages[currentImage!.url]!.status === 'error' && (
<div className="flex max-w-sm flex-col items-center gap-y-2 system-sm-regular text-text-tertiary">
<span>{`Failed to load image: ${currentImage!.url}. Please try again.`}</span>
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
index 2ecf666c3da..a366e0c2283 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
@@ -6,7 +6,7 @@ import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import AppIcon from '@/app/components/base/app-icon'
import { Infotip } from '@/app/components/base/infotip'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import WorkflowPreview from '@/app/components/workflow/workflow-preview'
import { usePipelineTemplateById } from '@/service/use-pipeline'
import ChunkStructureCard from './chunk-structure-card'
@@ -40,7 +40,7 @@ const Details = ({ id, type, onApplyTemplate, onClose }: DetailsProps) => {
const chunkStructureConfig = useChunkStructureConfig()
if (!pipelineTemplateInfo) {
- return <Loading type="app" />
+ return <LoadingPlaceholder className="h-full" />
}
return (
diff --git a/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx b/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx
index 3a74efb077f..30fb15336ab 100644
--- a/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx
@@ -1,6 +1,6 @@
import type { MockedFunction } from 'vite-plus/test'
import type { CustomFile as File } from '@/models/datasets'
-import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import { fetchFilePreview } from '@/service/common'
import FilePreview from '../index'
@@ -45,7 +45,7 @@ const renderFilePreview = (props: Partial<{ file?: File; hidePreview: () => void
// Helper to find the loading spinner element
const findLoadingSpinner = (container: HTMLElement) => {
- return container.querySelector('.spin-animation')
+ return within(container).queryByRole('progressbar')
}
// FilePreview Component Tests
@@ -101,8 +101,6 @@ describe('FilePreview', () => {
)
const { container } = renderFilePreview()
-
- // Assert - Loading should be visible initially (using spin-animation class)
const loadingElement = findLoadingSpinner(container)
expect(loadingElement)!.toBeInTheDocument()
})
diff --git a/web/app/components/datasets/create/file-preview/index.tsx b/web/app/components/datasets/create/file-preview/index.tsx
index 50c4f56bcd4..52738e6fde3 100644
--- a/web/app/components/datasets/create/file-preview/index.tsx
+++ b/web/app/components/datasets/create/file-preview/index.tsx
@@ -5,7 +5,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { fetchFilePreview } from '@/service/common'
import s from './index.module.css'
@@ -60,7 +60,7 @@ const FilePreview = ({ file, hidePreview }: IProps) => {
</div>
</div>
<div className={cn(s.previewContent)}>
- {loading && <Loading type="area" />}
+ {loading && <LoadingPlaceholder />}
{!loading && <div className={cn(s.fileContent, 'body-md-regular')}>{previewContent}</div>}
</div>
</div>
diff --git a/web/app/components/datasets/create/index.tsx b/web/app/components/datasets/create/index.tsx
index edadbcacfce..4b942d02529 100644
--- a/web/app/components/datasets/create/index.tsx
+++ b/web/app/components/datasets/create/index.tsx
@@ -15,7 +15,7 @@ import { useQueryState } from 'nuqs'
import * as React from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import {
settingsQueryParamName,
@@ -147,7 +147,7 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {
}, [datasetId, router, shouldRedirectToDocuments])
if ((!!datasetId && isLoadingWorkspacePermissionKeys) || shouldRedirectToDocuments)
- return <Loading type="app" />
+ return <LoadingPlaceholder className="h-full" />
if (fetchingAuthedDataSourceListError)
return (
@@ -161,7 +161,7 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {
<div className="flex h-full min-h-0 flex-col overflow-hidden bg-components-panel-bg">
<TopBar activeIndex={step - 1} datasetId={datasetId} />
<div className="min-h-0 flex-1">
- {isLoadingAuthedDataSourceList && <Loading type="app" />}
+ {isLoadingAuthedDataSourceList && <LoadingPlaceholder className="h-full" />}
{!isLoadingAuthedDataSourceList && (
<>
{step === 1 && (
diff --git a/web/app/components/datasets/create/notion-page-preview/__tests__/index.spec.tsx b/web/app/components/datasets/create/notion-page-preview/__tests__/index.spec.tsx
index 9c39ccfeed2..bb4c8037968 100644
--- a/web/app/components/datasets/create/notion-page-preview/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/create/notion-page-preview/__tests__/index.spec.tsx
@@ -1,6 +1,6 @@
import type { MockedFunction } from 'vite-plus/test'
import type { NotionPage } from '@/models/common'
-import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import { fetchNotionPagePreview } from '@/service/datasets'
import NotionPagePreview from '../index'
@@ -78,7 +78,7 @@ const renderNotionPagePreview = async (
if (waitForContent && defaultProps.currentPage) {
await waitFor(() => {
// Wait for loading to finish
- expect(result.container.querySelector('.spin-animation')).not.toBeInTheDocument()
+ expect(within(result.container).queryByRole('progressbar')).not.toBeInTheDocument()
})
}
@@ -90,7 +90,7 @@ const renderNotionPagePreview = async (
// Helper to find the loading spinner element
const findLoadingSpinner = (container: HTMLElement) => {
- return container.querySelector('.spin-animation')
+ return within(container).queryByRole('progressbar')
}
// NotionPagePreview Component Tests
diff --git a/web/app/components/datasets/create/notion-page-preview/index.tsx b/web/app/components/datasets/create/notion-page-preview/index.tsx
index aa950f39c47..3020d87b1cc 100644
--- a/web/app/components/datasets/create/notion-page-preview/index.tsx
+++ b/web/app/components/datasets/create/notion-page-preview/index.tsx
@@ -5,7 +5,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import NotionIcon from '@/app/components/base/notion-icon'
import { fetchNotionPagePreview } from '@/service/datasets'
import s from './index.module.css'
@@ -66,7 +66,7 @@ const NotionPagePreview = ({ currentPage, notionCredentialId, hidePreview }: IPr
</div>
</div>
<div className={cn(s.previewContent, 'body-md-regular')}>
- {loading && <Loading type="area" />}
+ {loading && <LoadingPlaceholder />}
{!loading && <div className={cn(s.fileContent, 'body-md-regular')}>{previewContent}</div>}
</div>
</div>
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx
index a5adde73673..7d7d40c8345 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx
@@ -263,7 +263,7 @@ describe('OnlineDocuments', () => {
render(<OnlineDocuments {...props} />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should render PageSelector when documentsData has content', () => {
@@ -273,7 +273,7 @@ describe('OnlineDocuments', () => {
render(<OnlineDocuments {...props} />)
expect(screen.getByTestId('page-selector')).toBeInTheDocument()
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
})
it('should render Title with datasource_label', () => {
@@ -654,7 +654,7 @@ describe('OnlineDocuments', () => {
render(<OnlineDocuments {...props} />)
// Assert - Should show loading instead of PageSelector
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
})
@@ -870,7 +870,7 @@ describe('OnlineDocuments', () => {
render(<OnlineDocuments {...props} />)
// Assert - Should show loading when documentsData is undefined
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should handle undefined datasource_parameters (line 79 branch)', () => {
@@ -1119,7 +1119,7 @@ describe('OnlineDocuments', () => {
})
// Should still show loading since documentsData is empty
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should handle credential change and refetch documents', () => {
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx
index e4b8d95ecc2..76e1e62c4d0 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx
@@ -5,7 +5,7 @@ import { toast } from '@langgenius/dify-ui/toast'
import { useQueryState } from 'nuqs'
import { useCallback, useEffect, useMemo } from 'react'
import { useShallow } from 'zustand/react/shallow'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import SearchInput from '@/app/components/base/notion-page-selector/search-input'
import {
settingsQueryParamName,
@@ -181,7 +181,7 @@ const OnlineDocuments = ({
/>
) : (
<div className="flex h-74 items-center justify-center">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
</div>
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/__tests__/index.spec.tsx
index c10ec958f00..cc7cf8cb0d6 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/__tests__/index.spec.tsx
@@ -1,5 +1,5 @@
import type { OnlineDriveFile } from '@/models/pipeline'
-import { fireEvent, render, screen } from '@testing-library/react'
+import { fireEvent, render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import * as React from 'react'
import { OnlineDriveFileType } from '@/models/pipeline'
@@ -114,9 +114,7 @@ describe('FileList', () => {
const props = createDefaultProps({ isLoading: true, fileList: [] })
const { container } = render(<FileList {...props} />)
-
- // Assert - Loading component should be rendered with spin-animation class
- expect(container.querySelector('.spin-animation')).toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).toBeInTheDocument()
})
it('should show empty folder state when not loading and fileList is empty', () => {
@@ -202,9 +200,7 @@ describe('FileList', () => {
const props = createDefaultProps({ isLoading: true, fileList: [] })
const { container } = render(<FileList {...props} />)
-
- // Assert - Loading component with spin-animation class
- expect(container.querySelector('.spin-animation')).toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).toBeInTheDocument()
})
it('should show loading indicator at bottom when isLoading is true with files', () => {
@@ -509,7 +505,7 @@ describe('FileList', () => {
const { container } = render(<FileList {...props} />)
if (isLoading && fileCount === 0)
- expect(container.querySelector('.spin-animation')).toBeInTheDocument()
+ expect(within(container).queryByRole('progressbar')).toBeInTheDocument()
else if (!isLoading && fileCount === 0)
expect(screen.getByText('datasetPipeline.onlineDrive.emptyFolder')).toBeInTheDocument()
else expect(screen.getByText('file-0.txt')).toBeInTheDocument()
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/index.spec.tsx
index 49a9b55b465..ea0d7ae0bb2 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/index.spec.tsx
@@ -190,7 +190,7 @@ describe('List', () => {
render(<List {...props} />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should render EmptyFolder when folder is empty and not loading', () => {
@@ -373,7 +373,7 @@ describe('List', () => {
switch (expected) {
case 'isAllLoading':
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
break
case 'isPartialLoading':
expect(screen.getByRole('status')).toBeInTheDocument()
@@ -824,11 +824,11 @@ describe('List', () => {
const { rerender } = render(<List {...props1} />)
// Assert initial loading state
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
rerender(<List {...props2} />)
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
expect(screen.getByTestId('empty-folder')).toBeInTheDocument()
})
@@ -840,11 +840,11 @@ describe('List', () => {
const { rerender } = render(<List {...props1} />)
// Assert initial loading state
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
rerender(<List {...props2} />)
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
expect(screen.getByTestId('item-file-1')).toBeInTheDocument()
})
@@ -934,7 +934,7 @@ describe('List', () => {
switch (expectedState) {
case 'all-loading':
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
break
case 'partial-loading':
expect(screen.getByRole('status')).toBeInTheDocument()
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx
index 993f9b3fd0f..c9f7245f2b3 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx
@@ -4,7 +4,7 @@ import { RiLoader2Line } from '@remixicon/react'
import * as React from 'react'
import { useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDataSourceStore } from '../../../store'
import EmptyFolder from './empty-folder'
import EmptySearchResult from './empty-search-result'
@@ -79,7 +79,7 @@ const List = ({
return (
<div className="grow overflow-hidden p-1 pt-0">
- {isAllLoading && <Loading type="app" />}
+ {isAllLoading && <LoadingPlaceholder className="h-full" />}
{isEmptyFolder && <EmptyFolder />}
{isSearchResultEmpty && <EmptySearchResult onResetKeywords={handleResetKeywords} />}
{fileList.length > 0 && (
diff --git a/web/app/components/datasets/documents/create-from-pipeline/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/index.tsx
index 3289ca27632..3684635756d 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/index.tsx
@@ -9,7 +9,7 @@ import { useBoolean } from 'ahooks'
import { useAtomValue } from 'jotai'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { PlanUpgradeModal } from '@/app/components/billing/plan-upgrade-modal'
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
import {
@@ -246,9 +246,10 @@ const CreateFormPipeline = () => {
router.replace(`/datasets/${dataset.id}/documents`)
}, [dataset, router, shouldRedirectToDocuments])
- if (isFetchingPipelineInfo) return <Loading type="app" />
+ if (isFetchingPipelineInfo) return <LoadingPlaceholder className="h-full" />
- if (isLoadingWorkspacePermissionKeys || shouldRedirectToDocuments) return <Loading type="app" />
+ if (isLoadingWorkspacePermissionKeys || shouldRedirectToDocuments)
+ return <LoadingPlaceholder className="h-full" />
return (
<div className="relative flex h-[calc(100vh-56px)] w-full min-w-5xl overflow-x-auto rounded-t-2xl border-t border-effects-highlight bg-background-default-subtle">
diff --git a/web/app/components/datasets/documents/detail/index.tsx b/web/app/components/datasets/documents/detail/index.tsx
index 8b28a7c310b..c6ca1e714bd 100644
--- a/web/app/components/datasets/documents/detail/index.tsx
+++ b/web/app/components/datasets/documents/detail/index.tsx
@@ -13,7 +13,7 @@ import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Divider from '@/app/components/base/divider'
import FloatRightContainer from '@/app/components/base/float-right-container'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import Metadata from '@/app/components/datasets/metadata/metadata-document'
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
@@ -355,7 +355,7 @@ const DocumentDetail: FC<DocumentDetailProps> = ({ datasetId, documentId }) => {
</div>
<div className="flex flex-1 flex-row" style={{ height: 'calc(100% - 4rem)' }}>
{isDetailLoading ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : (
<div
className={cn(
diff --git a/web/app/components/datasets/documents/detail/settings/__tests__/document-settings.spec.tsx b/web/app/components/datasets/documents/detail/settings/__tests__/document-settings.spec.tsx
index 11135337ba8..a07df9e606d 100644
--- a/web/app/components/datasets/documents/detail/settings/__tests__/document-settings.spec.tsx
+++ b/web/app/components/datasets/documents/detail/settings/__tests__/document-settings.spec.tsx
@@ -65,8 +65,8 @@ vi.mock('@/app/components/base/app-unavailable', () => ({
),
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: ({ type }: { type?: string }) => (
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: ({ type }: { type?: string }) => (
<div data-testid="loading" data-type={type}>
Loading...
</div>
diff --git a/web/app/components/datasets/documents/detail/settings/document-settings.tsx b/web/app/components/datasets/documents/detail/settings/document-settings.tsx
index 94f6457181f..4725e69e0f0 100644
--- a/web/app/components/datasets/documents/detail/settings/document-settings.tsx
+++ b/web/app/components/datasets/documents/detail/settings/document-settings.tsx
@@ -15,7 +15,7 @@ import { useCallback, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { useContext } from 'use-context-selector'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import StepTwo from '@/app/components/datasets/create/step-two'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
@@ -184,7 +184,7 @@ const DocumentSettings = ({ datasetId, documentId }: DocumentSettingsProps) => {
return (
<div className="flex" style={{ height: 'calc(100vh - 56px)' }}>
<div className="grow">
- {!documentDetail && <Loading type="app" />}
+ {!documentDetail && <LoadingPlaceholder className="h-full" />}
{dataset && documentDetail && (
<StepTwo
isAPIKeySet={!!embeddingsDefaultModel}
diff --git a/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx b/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx
index d2656c74ef0..dd003a157d8 100644
--- a/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx
+++ b/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx
@@ -5,7 +5,7 @@ import { noop } from 'es-toolkit/function'
import { useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
import { DatasourceType } from '@/models/pipeline'
import { useRouter } from '@/next/navigation'
@@ -178,7 +178,7 @@ const PipelineSettings = ({ datasetId, documentId }: PipelineSettingsProps) => {
)
if (isFetchingLastRunData) {
- return <Loading type="app" />
+ return <LoadingPlaceholder className="h-full" />
}
if (isError)
diff --git a/web/app/components/datasets/documents/index.tsx b/web/app/components/datasets/documents/index.tsx
index e05cfbd2414..c07d66c5ab3 100644
--- a/web/app/components/datasets/documents/index.tsx
+++ b/web/app/components/datasets/documents/index.tsx
@@ -4,7 +4,7 @@ import type { FC } from 'react'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import { useCallback } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { userProfileQueryOptions } from '@/features/account-profile/client'
@@ -138,7 +138,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
// Render content based on loading and data state
const renderContent = () => {
- if (isListLoading && !documentsRes) return <Loading type="app" />
+ if (isListLoading && !documentsRes) return <LoadingPlaceholder className="h-full" />
if (total > 0) {
return (
diff --git a/web/app/components/datasets/external-api/external-api-panel/index.tsx b/web/app/components/datasets/external-api/external-api-panel/index.tsx
index 7783db3e458..554458f77e7 100644
--- a/web/app/components/datasets/external-api/external-api-panel/index.tsx
+++ b/web/app/components/datasets/external-api/external-api-panel/index.tsx
@@ -5,7 +5,7 @@ import { RiAddLine, RiBookOpenLine, RiCloseLine } from '@remixicon/react'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDocLink } from '@/context/i18n'
import { useModalContext } from '@/context/modal-context'
import { consoleQuery } from '@/service/console'
@@ -95,7 +95,7 @@ const ExternalAPIPanel: React.FC<ExternalAPIPanelProps> = ({
)}
<div className="flex grow flex-col items-start gap-1 self-stretch px-4 py-0">
{isLoading ? (
- <Loading />
+ <LoadingPlaceholder />
) : (
externalKnowledgeApiList.map((api, index) => (
<ExternalKnowledgeAPICard
diff --git a/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx b/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx
index 038a3d386d7..9fcd95100a6 100644
--- a/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx
+++ b/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx
@@ -435,7 +435,7 @@ describe('HitTestingPage', () => {
renderWithProviders(<HitTestingPage datasetId="dataset-1" />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('shows both empty history and empty result states', () => {
diff --git a/web/app/components/datasets/hit-testing/index.tsx b/web/app/components/datasets/hit-testing/index.tsx
index 46029b40338..1d44c332101 100644
--- a/web/app/components/datasets/hit-testing/index.tsx
+++ b/web/app/components/datasets/hit-testing/index.tsx
@@ -28,7 +28,7 @@ import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useContext } from 'use-context-selector'
import FloatRightContainer from '@/app/components/base/float-right-container'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import docStyle from '@/app/components/datasets/documents/detail/completed/style.module.css'
import DatasetDetailContext from '@/context/dataset-detail'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
@@ -153,7 +153,7 @@ const HitTestingPage: FC<Props> = ({ datasetId }: Props) => {
setShowRightPanel(!isMobile)
}, [isMobile, setShowRightPanel])
- if (!canRunRetrievalRecall) return <Loading type="app" />
+ if (!canRunRetrievalRecall) return <LoadingPlaceholder className="h-full" />
return (
<div className="relative flex size-full gap-x-6 overflow-y-auto pl-6">
@@ -188,7 +188,7 @@ const HitTestingPage: FC<Props> = ({ datasetId }: Props) => {
</div>
{isRecordsLoading && (
<div className="flex-1">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
{!isRecordsLoading && recordsRes?.data && recordsRes.data.length > 0 && (
diff --git a/web/app/components/datasets/list/datasets.tsx b/web/app/components/datasets/list/datasets.tsx
index fbf6ea88c33..f09b0f81010 100644
--- a/web/app/components/datasets/list/datasets.tsx
+++ b/web/app/components/datasets/list/datasets.tsx
@@ -4,7 +4,7 @@ import type { ReactNode } from 'react'
import type { useDatasetList } from '@/service/knowledge/use-dataset'
import { useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
import DatasetCard from './dataset-card'
import DatasetCardSkeleton from './dataset-card-skeleton'
@@ -90,7 +90,7 @@ const Datasets = ({
))
)}
{!showDatasetSkeleton && !hasAnyDataset && emptyElement}
- {isFetchingNextPage && <Loading />}
+ {isFetchingNextPage && <LoadingPlaceholder />}
<div ref={anchorRef} className="h-0" />
</div>
</>
diff --git a/web/app/components/explore/installed-app/index.tsx b/web/app/components/explore/installed-app/index.tsx
index 5ab42f7a681..53b1b662c73 100644
--- a/web/app/components/explore/installed-app/index.tsx
+++ b/web/app/components/explore/installed-app/index.tsx
@@ -4,7 +4,7 @@ import type { AppData } from '@/models/share'
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
import * as React from 'react'
import { useEffect } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import TextGenerationApp from '@/app/components/share/text-generation'
import { useWebAppStore } from '@/context/web-app-context'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
@@ -224,7 +224,7 @@ const InstalledApp = ({ id }: { id: string }) => {
return (
<InstalledAppFrame>
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
</InstalledAppFrame>
)
diff --git a/web/app/components/explore/try-app/__tests__/index.spec.tsx b/web/app/components/explore/try-app/__tests__/index.spec.tsx
index 9b4b1de96f4..bc67cb08007 100644
--- a/web/app/components/explore/try-app/__tests__/index.spec.tsx
+++ b/web/app/components/explore/try-app/__tests__/index.spec.tsx
@@ -123,7 +123,7 @@ describe('TryApp (main index.tsx)', () => {
render(<TryApp appId="test-app-id" onClose={vi.fn()} onCreate={vi.fn()} />)
- expect(document.body.querySelector('[role="status"]')).toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).toBeInTheDocument()
})
it('renders unavailable state when the app detail request fails', () => {
diff --git a/web/app/components/explore/try-app/app/__tests__/text-generation.spec.tsx b/web/app/components/explore/try-app/app/__tests__/text-generation.spec.tsx
index eaa009acfcb..f4a942c2eb3 100644
--- a/web/app/components/explore/try-app/app/__tests__/text-generation.spec.tsx
+++ b/web/app/components/explore/try-app/app/__tests__/text-generation.spec.tsx
@@ -129,7 +129,7 @@ describe('TextGeneration', () => {
it('renders loading when appData is null', () => {
render(<TextGeneration appId="test-app-id" appData={null} />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('renders loading when appParams is not available', () => {
@@ -140,7 +140,7 @@ describe('TextGeneration', () => {
render(<TextGeneration appId="test-app-id" appData={createMockAppData()} />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
})
diff --git a/web/app/components/explore/try-app/app/text-generation.tsx b/web/app/components/explore/try-app/app/text-generation.tsx
index 5dcb4a38ae1..b837e63654d 100644
--- a/web/app/components/explore/try-app/app/text-generation.tsx
+++ b/web/app/components/explore/try-app/app/text-generation.tsx
@@ -13,7 +13,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Alert from '@/app/components/base/alert'
import AppIcon from '@/app/components/base/app-icon'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import Res from '@/app/components/share/text-generation/result'
import { TaskStatus } from '@/app/components/share/text-generation/types'
import { appDefaultIconBackground } from '@/config'
@@ -173,7 +173,7 @@ const TextGeneration: FC<Props> = ({ appId, className, isWorkflow, appData }) =>
if (!siteInfo || !promptConfig) {
return (
<div className={cn('flex h-screen items-center', className)}>
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
diff --git a/web/app/components/explore/try-app/index.tsx b/web/app/components/explore/try-app/index.tsx
index 956350e293d..0f6c9b64d9e 100644
--- a/web/app/components/explore/try-app/index.tsx
+++ b/web/app/components/explore/try-app/index.tsx
@@ -7,7 +7,7 @@ import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import AppUnavailable from '@/app/components/base/app-unavailable'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useGetTryAppInfo } from '@/service/use-try-app'
import App from './app'
import AppInfo from './app-info'
@@ -49,7 +49,7 @@ function TryApp({
<DialogContent className="h-[calc(100dvh-32px)] max-h-[calc(100dvh-32px)] w-full max-w-[calc(100vw-32px)] min-w-7xl overflow-hidden overflow-x-auto border-none p-2 text-left align-middle">
{isLoading ? (
<div className="flex h-full items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
) : isError ? (
<div className="flex h-full items-center justify-center">
diff --git a/web/app/components/explore/try-app/preview/basic-app-preview.tsx b/web/app/components/explore/try-app/preview/basic-app-preview.tsx
index b300fea050b..7ad787ea41c 100644
--- a/web/app/components/explore/try-app/preview/basic-app-preview.tsx
+++ b/web/app/components/explore/try-app/preview/basic-app-preview.tsx
@@ -12,7 +12,7 @@ import { useMemo, useState } from 'react'
import Config from '@/app/components/app/configuration/config'
import Debug from '@/app/components/app/configuration/debug'
import { FeaturesProvider } from '@/app/components/base/features'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { CollectionType } from '@/app/components/tools/types'
@@ -523,7 +523,7 @@ const BasicAppPreview: FC<Props> = ({ appId }) => {
if (isLoading) {
return (
<div className="flex h-full items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/explore/try-app/preview/flow-app-preview.tsx b/web/app/components/explore/try-app/preview/flow-app-preview.tsx
index bb132171db8..a5b253a9734 100644
--- a/web/app/components/explore/try-app/preview/flow-app-preview.tsx
+++ b/web/app/components/explore/try-app/preview/flow-app-preview.tsx
@@ -4,7 +4,7 @@ import type { FC } from 'react'
import type { Edge, Node } from '@/app/components/workflow/types'
import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { BlockEnum } from '@/app/components/workflow/types'
import WorkflowPreview from '@/app/components/workflow/workflow-preview'
import { useGetTryAppFlowPreview } from '@/service/use-try-app'
@@ -158,7 +158,7 @@ const FlowAppPreview: FC<Props> = ({ appId, className }) => {
if (isLoading) {
return (
<div className="flex h-full items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/full-screen-loading.tsx b/web/app/components/full-screen-loading.tsx
index 17bdfcbf90b..e2f57b50202 100644
--- a/web/app/components/full-screen-loading.tsx
+++ b/web/app/components/full-screen-loading.tsx
@@ -1,9 +1,5 @@
-import Loading from './base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
export function FullScreenLoading() {
- return (
- <div className="flex min-h-dvh w-full flex-1 items-center justify-center bg-background-body">
- <Loading />
- </div>
- )
+ return <LoadingPlaceholder className="min-h-dvh flex-1 bg-background-body" />
}
diff --git a/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx b/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx
index 80457f9e862..5c5e2c184f7 100644
--- a/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx
@@ -8,7 +8,7 @@ import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useAtomValue } from 'jotai'
import { memo, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { hasPermission } from '@/utils/permission'
import AccessRuleRow from './access-rule-row'
@@ -150,7 +150,7 @@ const AccessRuleSection = ({
</div>
) : isLoadingRules ? (
<div className="px-1 py-8 text-center">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
) : rules.length === 0 ? (
<div className="px-1 py-8 text-center system-sm-regular text-text-tertiary">
@@ -171,7 +171,7 @@ const AccessRuleSection = ({
<div ref={anchorRef} className="h-1" />
{isFetchingNextPage && (
<div className="px-1 py-3 text-center system-xs-regular text-text-tertiary">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
</>
diff --git a/web/app/components/header/account-setting/data-source-page-new/__tests__/install-from-marketplace.spec.tsx b/web/app/components/header/account-setting/data-source-page-new/__tests__/install-from-marketplace.spec.tsx
index 4e5b9d259f9..9b208ce8139 100644
--- a/web/app/components/header/account-setting/data-source-page-new/__tests__/install-from-marketplace.spec.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/__tests__/install-from-marketplace.spec.tsx
@@ -137,7 +137,7 @@ describe('InstallFromMarketplace Component', () => {
expect(screen.getByTestId('mock-list')).toHaveClass('grid', 'grid-cols-3', 'gap-2')
expect(screen.getByTestId('mock-provider-card-plugin-1')).toHaveClass('h-36.5')
expect(screen.queryByTestId('mock-provider-card-bundle-1')).not.toBeInTheDocument()
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
})
it('should show loading state when marketplace plugins are loading and component is not collapsed', () => {
@@ -151,7 +151,7 @@ describe('InstallFromMarketplace Component', () => {
render(<InstallFromMarketplace providers={mockProviders} searchText="" />)
// Assert
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
expect(screen.queryByTestId('mock-list')).not.toBeInTheDocument()
})
})
@@ -190,7 +190,7 @@ describe('InstallFromMarketplace Component', () => {
fireEvent.click(toggleHeader)
// Assert
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
})
it('should use the marketplace callback action when provided', () => {
diff --git a/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx b/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx
index 84d181587e7..244a3086f1e 100644
--- a/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx
@@ -5,7 +5,7 @@ import { useTheme } from 'next-themes'
import { memo, useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Divider from '@/app/components/base/divider'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import List from '@/app/components/plugins/marketplace/list'
import { getMarketplaceCategoryUrl } from '@/app/components/plugins/marketplace/utils'
import { usePluginSettingsAccess } from '@/app/components/plugins/plugin-page/use-reference-setting'
@@ -81,7 +81,7 @@ const InstallFromMarketplace = ({
)}
</div>
</div>
- {!collapse && isAllPluginsLoading && <Loading type="area" />}
+ {!collapse && isAllPluginsLoading && <LoadingPlaceholder />}
{!isAllPluginsLoading && !collapse && (
<List
marketplaceCollections={[]}
diff --git a/web/app/components/header/account-setting/members-page/__tests__/invite-button.spec.tsx b/web/app/components/header/account-setting/members-page/__tests__/invite-button.spec.tsx
index 612c3c3e5aa..8143eda2b8f 100644
--- a/web/app/components/header/account-setting/members-page/__tests__/invite-button.spec.tsx
+++ b/web/app/components/header/account-setting/members-page/__tests__/invite-button.spec.tsx
@@ -55,7 +55,7 @@ describe('InviteButton', () => {
renderInviteButton(true)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should hide invite button when permission is denied', () => {
diff --git a/web/app/components/header/account-setting/members-page/invite-button.tsx b/web/app/components/header/account-setting/members-page/invite-button.tsx
index 272f4f8522d..60676bc4ab1 100644
--- a/web/app/components/header/account-setting/members-page/invite-button.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-button.tsx
@@ -3,7 +3,7 @@ import { Button } from '@langgenius/dify-ui/button'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { currentWorkspaceIdAtom } from '@/context/workspace-state'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { useWorkspacePermissions } from '@/service/use-workspace'
@@ -18,7 +18,7 @@ const InviteButton = (props: InviteButtonProps) => {
useWorkspacePermissions(currentWorkspaceId, systemFeatures.branding.enabled)
if (systemFeatures.branding.enabled) {
if (isFetchingWorkspacePermissions) {
- return <Loading />
+ return <LoadingPlaceholder />
}
if (!workspacePermissions || workspacePermissions.allow_member_invite !== true) {
return null
diff --git a/web/app/components/header/account-setting/members-page/member-details-modal/__tests__/index.spec.tsx b/web/app/components/header/account-setting/members-page/member-details-modal/__tests__/index.spec.tsx
index 893d6089578..5adf452534e 100644
--- a/web/app/components/header/account-setting/members-page/member-details-modal/__tests__/index.spec.tsx
+++ b/web/app/components/header/account-setting/members-page/member-details-modal/__tests__/index.spec.tsx
@@ -126,7 +126,7 @@ describe('MemberDetailsModal', () => {
/>,
)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(
screen.getByRole('button', { name: /members\.memberDetails\.assign/i }),
).toBeInTheDocument()
diff --git a/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx b/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
index a9cbcd171e6..93f5dbf6d65 100644
--- a/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
@@ -8,7 +8,7 @@ import { IconButton } from '@langgenius/dify-ui/icon-button'
import { memo, useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { getAccessControlTemplateLanguage } from '@/i18n-config/language'
import { useRolesOfMember } from '@/service/access-control/use-member-roles'
import AssignRolesModal from '../assign-roles-modal'
@@ -156,7 +156,7 @@ const MemberDetailsModal = ({
{isLoadingRolesOfMember ? (
<div className="mt-4">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : (
<>
diff --git a/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx b/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx
index aa800e85f42..9e18f1155d8 100644
--- a/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx
@@ -48,8 +48,8 @@ vi.mock('@/app/components/base/divider', () => ({
default: () => <div data-testid="divider" />,
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div data-testid="loading" />,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div data-testid="loading" />,
}))
vi.mock('@/app/components/plugins/marketplace/list', () => ({
diff --git a/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx b/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
index 9bf467f009d..ce33de9f470 100644
--- a/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
@@ -5,7 +5,7 @@ import { useTheme } from 'next-themes'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Divider from '@/app/components/base/divider'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import List from '@/app/components/plugins/marketplace/list'
import { getMarketplaceCategoryUrl } from '@/app/components/plugins/marketplace/utils'
import { usePluginSettingsAccess } from '@/app/components/plugins/plugin-page/use-reference-setting'
@@ -124,9 +124,9 @@ const InstallFromMarketplace = ({
</div>
</div>
{!collapse && shouldLoadMarketplace && !hasLoadedInstalledPluginIds && (
- <Loading type="area" />
+ <LoadingPlaceholder />
)}
- {!collapse && hasLoadedInstalledPluginIds && isAllPluginsLoading && <Loading type="area" />}
+ {!collapse && hasLoadedInstalledPluginIds && isAllPluginsLoading && <LoadingPlaceholder />}
{!isAllPluginsLoading && !collapse && hasLoadedInstalledPluginIds && (
<List
marketplaceCollections={[]}
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx
index 5278c4b059c..fc5b3e973c8 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx
@@ -233,7 +233,7 @@ describe('ModelModal', () => {
expect(screen.getByText('common.modelProvider.auth.apiKeyModal.title'))!.toBeInTheDocument()
expect(screen.getByText('common.modelProvider.auth.apiKeyModal.desc'))!.toBeInTheDocument()
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar'))!.toBeInTheDocument()
expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeDisabled()
predefined.unmount()
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
index e5e1692e731..62661dedc12 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
@@ -23,7 +23,7 @@ import Badge from '@/app/components/base/badge'
import AuthForm from '@/app/components/base/form/form-scenarios/auth'
import { LinkExternal02 } from '@/app/components/base/icons/src/vender/line/general'
import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
useAuth,
useCredentialData,
@@ -360,7 +360,7 @@ const ModelModal: FC<ModelModalProps> = ({
)}
{isLoading && (
<div className="mt-3 flex items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{!isLoading && showCredentialForm && (
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx
index 50f37ab36f5..2535bc36a03 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx
@@ -337,7 +337,7 @@ describe('ModelParameterModal', () => {
isRulesPending = true
render(<ModelParameterModal {...defaultProps} />)
openSettings()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should not render parameter loading when model is not configured and parameter rules query is pending but disabled', () => {
@@ -347,7 +347,7 @@ describe('ModelParameterModal', () => {
render(<ModelParameterModal {...defaultProps} provider="" modelId="" />)
openSettings()
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
expect(screen.getByTestId('model-selector')).toBeInTheDocument()
})
@@ -428,7 +428,7 @@ describe('ModelParameterModal', () => {
render(<ModelParameterModal {...defaultProps} />)
openSettings()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
expect(screen.queryByTestId('param-temperature')).not.toBeInTheDocument()
})
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx
index 905143d8c38..cfc62826278 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx
@@ -20,7 +20,7 @@ import {
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { PROVIDER_WITH_PRESET_TONE, STOP_PARAMETER_RULE } from '@/config'
import { useModelParameterRules } from '@/service/use-common'
import { ModelStatusEnum } from '../declarations'
@@ -241,7 +241,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
</div>
{isRulesLoading ? (
<div className="py-5">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : (
[...parameterRules, ...(isAdvancedMode ? [STOP_PARAMETER_RULE] : [])].map(
@@ -265,7 +265,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
)}
{!parameterRules.length && isRulesLoading && (
<div className="px-4 py-5">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx
index cdad3b6138d..dded8cc2881 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx
@@ -214,7 +214,7 @@ describe('ModelLoadBalancingModal', () => {
/>,
)
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar'))!.toBeInTheDocument()
})
it('should render predefined model content', () => {
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/quota-panel.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/quota-panel.spec.tsx
index 405bdbeee90..0deca7963ae 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/quota-panel.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/quota-panel.spec.tsx
@@ -189,7 +189,7 @@ describe('QuotaPanel', () => {
mockWorkspaceIsPending = true
renderQuotaPanel(<QuotaPanel providers={mockProviders} />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should show used credits, total credits, and reset date', () => {
@@ -210,7 +210,7 @@ describe('QuotaPanel', () => {
renderQuotaPanel(<QuotaPanel providers={mockProviders} />)
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
expect(screen.getByText('30')).toBeInTheDocument()
})
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
index 599d5bd8059..838b287eac3 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
@@ -20,7 +20,7 @@ import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import { toast } from '@langgenius/dify-ui/toast'
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { SwitchCredentialInLoadBalancing } from '@/app/components/header/account-setting/model-provider-page/model-auth'
import { useGetModelCredential, useUpdateModelLoadBalancingConfig } from '@/service/use-models'
import { ConfigurationMethodEnum, FormTypeEnum } from '../declarations'
@@ -277,7 +277,7 @@ const ModelLoadBalancingModal = ({
</DialogTitle>
{!draftConfig ? (
- <Loading type="area" />
+ <LoadingPlaceholder />
) : (
<>
<div className="py-2">
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
index c2b83f8f2e9..83f39732684 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
@@ -11,7 +11,7 @@ import { useBoolean } from 'ahooks'
import * as React from 'react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { PluginInstallPermissionProvider } from '@/app/components/plugins/install-plugin/components/plugin-install-permission-provider'
import useWorkspacePluginInstallPermission from '@/app/components/plugins/install-plugin/hooks/use-workspace-plugin-install-permission'
import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace'
@@ -177,7 +177,7 @@ const QuotaPanel: FC<QuotaPanelProps> = ({ providers }) => {
if (isLoading) {
return (
<div className="flex h-16 items-center justify-center rounded-xl border-[0.5px] border-components-panel-border bg-third-party-model-bg-default shadow-xs">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/header/account-setting/permissions-page/role-list/__tests__/index.spec.tsx b/web/app/components/header/account-setting/permissions-page/role-list/__tests__/index.spec.tsx
index c5bded8f322..6df03887216 100644
--- a/web/app/components/header/account-setting/permissions-page/role-list/__tests__/index.spec.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-list/__tests__/index.spec.tsx
@@ -67,7 +67,7 @@ describe('RoleList', () => {
it('shows a loading status while the first page is loading', () => {
render(<RoleList groups={[]} isLoading />)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByText(/permission\.role\.groups/)).not.toBeInTheDocument()
})
@@ -124,7 +124,7 @@ describe('RoleList', () => {
)
expect(screen.getByText('Owner')).toBeInTheDocument()
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
})
})
diff --git a/web/app/components/header/account-setting/permissions-page/role-list/index.tsx b/web/app/components/header/account-setting/permissions-page/role-list/index.tsx
index a8eacabb84b..453386140b1 100644
--- a/web/app/components/header/account-setting/permissions-page/role-list/index.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-list/index.tsx
@@ -4,7 +4,7 @@ import type { Role, RoleCategory } from '@/models/access-control'
import { cn } from '@langgenius/dify-ui/cn'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import Row from './row'
export type RoleListGroup = {
@@ -36,7 +36,7 @@ const RoleList = ({
if (isLoading) {
return (
<div className={cn('px-1 py-8 text-center', className)}>
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
@@ -68,7 +68,7 @@ const RoleList = ({
))}
{isFetchingNextPage && (
<div className="px-1 py-3 text-center">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
</div>
diff --git a/web/app/components/plugins/marketplace/list/__tests__/list-wrapper-scroll.browser.spec.tsx b/web/app/components/plugins/marketplace/list/__tests__/list-wrapper-scroll.browser.spec.tsx
index 0714b7cd62e..36d7e1bb8f9 100644
--- a/web/app/components/plugins/marketplace/list/__tests__/list-wrapper-scroll.browser.spec.tsx
+++ b/web/app/components/plugins/marketplace/list/__tests__/list-wrapper-scroll.browser.spec.tsx
@@ -25,10 +25,6 @@ vi.mock('#i18n', () => ({
}),
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div>loading</div>,
-}))
-
vi.mock('../../sort-dropdown', () => ({
default: () => <div>sort</div>,
}))
@@ -93,7 +89,8 @@ describe('Marketplace result scroll anchoring', () => {
const scrollTopBefore = scrollContainer.scrollTop
await screen.getByRole('button', { name: 'Type search' }).click()
- await expect.element(screen.getByText('1 plugins found')).toBeVisible()
+ await expect.element(screen.getByRole('status')).toHaveTextContent('1 plugins found')
+ await expect.element(screen.getByTestId('catalog-results')).toBeVisible()
await new Promise(requestAnimationFrame)
expect(scrollContainer.scrollTop).toBe(scrollTopBefore)
diff --git a/web/app/components/plugins/marketplace/list/__tests__/list-wrapper.spec.tsx b/web/app/components/plugins/marketplace/list/__tests__/list-wrapper.spec.tsx
index b011e742797..3ea68f8948a 100644
--- a/web/app/components/plugins/marketplace/list/__tests__/list-wrapper.spec.tsx
+++ b/web/app/components/plugins/marketplace/list/__tests__/list-wrapper.spec.tsx
@@ -32,14 +32,6 @@ vi.mock('#i18n', async () => {
}
})
-vi.mock('@/app/components/base/loading', () => ({
- default: ({ className }: { className?: string }) => (
- <div data-testid="loading" className={className}>
- loading
- </div>
- ),
-}))
-
vi.mock('../../sort-dropdown', () => ({
default: () => <div data-testid="sort-dropdown">sort</div>,
}))
@@ -58,7 +50,7 @@ vi.mock('../../state', () => ({
// tree needs an adapter even though the data hook itself is mocked.
const renderListWrapper = (ui: ReactNode) => {
const { wrapper: NuqsWrapper } = createNuqsTestWrapper({ searchParams: '' })
- return render(<NuqsWrapper>{ui}</NuqsWrapper>)
+ return render(ui, { wrapper: NuqsWrapper })
}
describe('ListWrapper', () => {
@@ -81,17 +73,49 @@ describe('ListWrapper', () => {
renderListWrapper(<ListWrapper />)
- expect(screen.getByText('1 plugins found')).toBeInTheDocument()
+ expect(screen.getByRole('status')).toHaveTextContent('1 plugins found')
expect(screen.getByTestId('sort-dropdown')).toBeInTheDocument()
})
+ it('keeps the status owner mounted through pagination and reports the total result count', () => {
+ mockMarketplaceData.plugins = [{ plugin_id: 'p1', name: 'Plugin One' } as Plugin]
+ mockMarketplaceData.pluginsTotal = 20
+ const view = renderListWrapper(<ListWrapper />)
+ const status = screen.getByRole('status')
+ expect(status).toHaveTextContent('20 plugins found')
+
+ mockMarketplaceData.isFetchingNextPage = true
+ view.rerender(<ListWrapper />)
+ expect(screen.getByRole('status')).toBe(status)
+ expect(status).toHaveTextContent('loading')
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
+
+ mockMarketplaceData.isFetchingNextPage = false
+ mockMarketplaceData.plugins = [
+ ...mockMarketplaceData.plugins,
+ { plugin_id: 'p2', name: 'Plugin Two' } as Plugin,
+ ]
+ view.rerender(<ListWrapper />)
+ expect(screen.getByRole('status')).toBe(status)
+ expect(status).toHaveTextContent('20 plugins found')
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
+
+ mockMarketplaceData.isRefreshing = true
+ view.rerender(<ListWrapper />)
+ expect(status).toHaveTextContent('loading')
+ mockMarketplaceData.isRefreshing = false
+ mockMarketplaceData.isError = true
+ view.rerender(<ListWrapper />)
+ expect(status).toHaveTextContent('marketplace.loadError')
+ })
+
it('shows centered loading on a cold start', () => {
mockMarketplaceData.isLoading = true
mockMarketplaceData.page = 1
renderListWrapper(<ListWrapper />)
- expect(screen.getByTestId('loading')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
// The reported "jitter": every debounced keystroke used to unmount the grid
@@ -107,7 +131,7 @@ describe('ListWrapper', () => {
const list = screen.getByTestId('list')
expect(list).toBeInTheDocument()
expect(list.parentElement).toHaveAttribute('aria-busy', 'true')
- expect(screen.queryByTestId('loading')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
})
it('renders list when loading additional pages', () => {
@@ -126,7 +150,7 @@ describe('ListWrapper', () => {
renderListWrapper(<ListWrapper />)
- expect(screen.getAllByTestId('loading')).toHaveLength(1)
+ expect(screen.getAllByRole('progressbar')).toHaveLength(1)
})
it('keeps the supplied layout constraint while category results are loading', () => {
@@ -136,7 +160,7 @@ describe('ListWrapper', () => {
const { container } = renderListWrapper(<ListWrapper className="catalog-content-min-height" />)
expect(container.firstElementChild).toHaveClass('catalog-content-min-height')
- expect(screen.getByTestId('loading')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
// A failed search used to arrive as a successful empty page and render as
@@ -149,7 +173,7 @@ describe('ListWrapper', () => {
renderListWrapper(<ListWrapper />)
expect(screen.queryByTestId('list')).not.toBeInTheDocument()
- expect(screen.getByText('marketplace.loadError')).toBeInTheDocument()
+ expect(screen.getByRole('status')).toHaveTextContent('marketplace.loadError')
await user.click(screen.getByRole('button', { name: 'operation.retry' }))
expect(mockMarketplaceData.refetch).toHaveBeenCalledTimes(1)
diff --git a/web/app/components/plugins/marketplace/list/list-wrapper.tsx b/web/app/components/plugins/marketplace/list/list-wrapper.tsx
index 61942e562cd..3945dfd22e0 100644
--- a/web/app/components/plugins/marketplace/list/list-wrapper.tsx
+++ b/web/app/components/plugins/marketplace/list/list-wrapper.tsx
@@ -4,7 +4,7 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useEffect, useRef } from 'react'
import { useTranslation } from '#i18n'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
flushMarketplaceSiteFilter,
flushMarketplaceSiteSearch,
@@ -82,6 +82,15 @@ const ListWrapper = ({
className,
)}
>
+ <div role="status" aria-atomic="true" className="sr-only">
+ {isLoading || isRefreshing || isFetchingNextPage
+ ? t(($) => $.loading, { ns: 'common' })
+ : isError
+ ? t(($) => $['marketplace.loadError'], { ns: 'plugin' })
+ : plugins
+ ? t(($) => $['marketplace.pluginsResult'], { ns: 'plugin', num: pluginsTotal })
+ : null}
+ </div>
<div className="flex w-full grow flex-col">
{plugins && (
<div className="mb-4 flex items-center pt-3">
@@ -124,10 +133,10 @@ const ListWrapper = ({
</div>
{isLoading && page === 1 && (
<div className="absolute top-1/2 left-1/2 -translate-1/2">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
- {isFetchingNextPage && <Loading className="my-3" />}
+ {isFetchingNextPage && <LoadingPlaceholder className="my-3" />}
</div>
)
}
diff --git a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
index e91a725ca5d..8e9d4839bc5 100644
--- a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
@@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next'
import { EncryptedBottom } from '@/app/components/base/encrypted-bottom'
import AuthForm from '@/app/components/base/form/form-scenarios/auth'
import { FormTypeEnum } from '@/app/components/base/form/types'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { PermissionLevel } from '@/models/permission'
import { ReadmeEntrance } from '../../readme-panel/entrance'
import {
@@ -180,7 +180,7 @@ const ApiKeyModal = ({
)}
{isLoading && (
<div className="flex h-40 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{!isLoading && !!mergedData.length && (
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/app-inputs-panel.spec.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/app-inputs-panel.spec.tsx
index 7bfbc10e016..f91f15ee05e 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/app-inputs-panel.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/app-inputs-panel.spec.tsx
@@ -10,8 +10,8 @@ let mockHookResult = {
retry: vi.fn(),
}
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div data-testid="loading">Loading</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div data-testid="loading">Loading</div>,
}))
vi.mock('@/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-form', () => ({
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx
index 33b4a425a17..595d8511527 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx
@@ -165,7 +165,7 @@ describe('AppSelector', () => {
await waitFor(() => {
expect(mockUseAppWorkflow).toHaveBeenCalledWith('app-2')
})
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
})
it('should reset the input draft when switching apps', async () => {
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx
index 1c06ddc2854..1b627b9ff08 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx
@@ -4,7 +4,7 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import AppInputsForm from '@/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-form'
import { useAppInputsFormSchema } from '@/app/components/plugins/plugin-detail-panel/app-selector/hooks/use-app-inputs-form-schema'
@@ -34,7 +34,7 @@ const AppInputsPanel = ({ value, appDetail, onFormChange }: Props) => {
<div className={cn('flex max-h-60 flex-col rounded-b-2xl border-t border-divider-subtle pb-4')}>
{isLoading && (
<div className="pt-3">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
{!isLoading && isError && (
diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx
index 53e7e0624ec..541831b81ed 100644
--- a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx
@@ -268,7 +268,7 @@ describe('LLMParamsPanel', () => {
render(<LLMParamsPanel {...props} />)
// Assert - Loading component uses aria-label instead of visible text
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should not render loading state when model is not configured and parameter rules query is pending but disabled', () => {
@@ -280,7 +280,7 @@ describe('LLMParamsPanel', () => {
render(<LLMParamsPanel {...props} />)
// Assert
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
expect(screen.getByText('common.modelProvider.parameters')).toBeInTheDocument()
})
@@ -848,8 +848,8 @@ describe('LLMParamsPanel', () => {
setupModelParameterRulesMock({ isPending: true })
rerender(<LLMParamsPanel {...props} />)
- // Assert - Loading component uses role="status" with aria-label
- expect(screen.getByRole('status')).toBeInTheDocument()
+ // Assert - Loading component uses role="progressbar" with aria-label
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should update when isAdvancedMode changes', () => {
diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx
index 80e8f24b7ad..76121c0fc77 100644
--- a/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx
@@ -7,7 +7,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import ParameterItem from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item'
import PresetsParameter from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter'
import { getSupportedPresetConfig } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter-utils'
@@ -70,7 +70,7 @@ const LLMParamsPanel = ({
if (isRulesLoading) {
return (
<div className="mt-5">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx
index 1b5d9de7177..b256ba29101 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx
@@ -114,7 +114,7 @@ describe('SubscriptionList', () => {
render(<SubscriptionList />)
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar'))!.toBeInTheDocument()
expect(screen.queryByText('Subscription One')).not.toBeInTheDocument()
})
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/index.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/index.tsx
index 867e2f36657..778164b11c2 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/index.tsx
@@ -1,7 +1,7 @@
import type { SimpleSubscription } from './types'
import type { PluginDetail } from '@/app/components/plugins/types'
import { withErrorBoundary } from '@/app/components/base/error-boundary'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { SubscriptionListView } from './list-view'
import { SubscriptionSelectorView } from './selector-view'
import { SubscriptionListMode } from './types'
@@ -27,7 +27,7 @@ export const SubscriptionList = withErrorBoundary(
if (isLoading) {
return (
<div className="flex items-center justify-center py-4">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/plugins/plugin-page/__tests__/plugins-panel.spec.tsx b/web/app/components/plugins/plugin-page/__tests__/plugins-panel.spec.tsx
index 7e25eae1328..69af145ed3b 100644
--- a/web/app/components/plugins/plugin-page/__tests__/plugins-panel.spec.tsx
+++ b/web/app/components/plugins/plugin-page/__tests__/plugins-panel.spec.tsx
@@ -951,6 +951,32 @@ describe('PluginsPanel', () => {
expect(mockLoadNextPage).toHaveBeenCalledTimes(1)
})
+ it('keeps an installed-results status through pagination without giving the spinner live-region ownership', () => {
+ mockPluginListWithLatestVersion.mockReturnValue([createPlugin('tool-plugin', 'Tool Plugin')])
+ const query = {
+ data: { plugins: [] },
+ isLoading: false,
+ isFetching: false,
+ isLastPage: false,
+ loadNextPage: mockLoadNextPage,
+ }
+ mockUseInstalledPluginList.mockReturnValue(query)
+ const view = render(<PluginsPanel fixedCategory={PluginCategoryEnum.tool} />)
+ const status = screen.getByRole('status')
+ expect(status).toHaveTextContent('plugin.marketplace.pluginsResult')
+
+ mockUseInstalledPluginList.mockReturnValue({ ...query, isFetching: true })
+ view.rerender(<PluginsPanel fixedCategory={PluginCategoryEnum.tool} />)
+ expect(screen.getByRole('status')).toBe(status)
+ expect(status).toHaveTextContent('common.loading')
+ expect(screen.getByRole('progressbar')).not.toHaveAttribute('aria-live')
+
+ mockUseInstalledPluginList.mockReturnValue({ ...query, isLastPage: true })
+ view.rerender(<PluginsPanel fixedCategory={PluginCategoryEnum.tool} />)
+ expect(screen.getByRole('status')).toBe(status)
+ expect(status).toHaveTextContent('plugin.marketplace.pluginsResult')
+ })
+
it('does not observe the Tool Plugin list while the next page is loading', () => {
mockPluginListWithLatestVersion.mockReturnValue([createPlugin('tool-plugin', 'Tool Plugin')])
mockUseInstalledPluginList.mockReturnValue({
diff --git a/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx b/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx
index e28ba2cfc82..c59c5ad8754 100644
--- a/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx
+++ b/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx
@@ -10,7 +10,7 @@ import { useTheme } from 'next-themes'
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Divider from '@/app/components/base/divider'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import List from '@/app/components/plugins/marketplace/list'
import { useMarketplacePlugins } from '@/app/components/plugins/marketplace/query'
import { getMarketplaceCategoryUrl } from '@/app/components/plugins/marketplace/utils'
@@ -117,7 +117,7 @@ const CategoryMarketplacePanel = ({
</div>
{!collapsed && (
<div>
- {showLoading && <Loading type="area" />}
+ {showLoading && <LoadingPlaceholder />}
{showInstalledPluginIdsError && (
<div className="flex flex-col items-center gap-2 py-4">
<span className="system-sm-regular text-text-tertiary" role="alert">
diff --git a/web/app/components/plugins/plugin-page/plugins-panel-results.tsx b/web/app/components/plugins/plugin-page/plugins-panel-results.tsx
index 3d0f46513f9..bfb81ae3a17 100644
--- a/web/app/components/plugins/plugin-page/plugins-panel-results.tsx
+++ b/web/app/components/plugins/plugin-page/plugins-panel-results.tsx
@@ -14,7 +14,7 @@ import {
} from '@langgenius/dify-ui/scroll-area'
import { useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import IntegrationsToolProviderCard from '@/app/components/integrations/tool-provider-card'
import { BuiltinMarketplacePanel } from '@/app/components/tools/marketplace/builtin-marketplace-panel'
import CategoryEmptyState from './category-empty-state'
@@ -121,6 +121,16 @@ const PluginsPanelResults = ({
contentFrameClassName,
)}
>
+ <div role="status" aria-atomic="true" className="sr-only">
+ {isFetching
+ ? t(($) => $.loading, { ns: 'common' })
+ : t(($) => $['marketplace.pluginsResult'], {
+ ns: 'plugin',
+ num:
+ (hasVisiblePlugins ? filteredList.length : 0) +
+ (hasVisibleBuiltinTools ? filteredBuiltinTools.length : 0),
+ })}
+ </div>
<ScrollAreaViewport
ref={containerRef}
aria-label={scrollAreaLabel}
@@ -166,7 +176,7 @@ const PluginsPanelResults = ({
{!isLastPage && (
<div className="flex w-full justify-center py-4">
{isFetching ? (
- <Loading className="size-8" />
+ <LoadingPlaceholder className="size-8" />
) : autoLoadNextPage ? null : (
<Button onClick={loadNextPage}>
{t(($) => $['common.loadMore'], { ns: 'workflow' })}
diff --git a/web/app/components/plugins/readme-panel/__tests__/index.spec.tsx b/web/app/components/plugins/readme-panel/__tests__/index.spec.tsx
index 650e7fba858..259ee1c80b5 100644
--- a/web/app/components/plugins/readme-panel/__tests__/index.spec.tsx
+++ b/web/app/components/plugins/readme-panel/__tests__/index.spec.tsx
@@ -170,7 +170,7 @@ describe('ReadmePanel', () => {
error: null,
})
const { rerender } = renderWithQueryClient(<ReadmePanel />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
mockUsePluginReadme.mockReturnValue({
data: null,
diff --git a/web/app/components/plugins/readme-panel/content.tsx b/web/app/components/plugins/readme-panel/content.tsx
index efcc42c8c49..8f2646f8428 100644
--- a/web/app/components/plugins/readme-panel/content.tsx
+++ b/web/app/components/plugins/readme-panel/content.tsx
@@ -3,7 +3,7 @@
import type { ReactNode } from 'react'
import type { PluginDetail } from '../types'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { Markdown } from '@/app/components/base/markdown'
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { usePluginReadme } from '@/service/use-plugins'
@@ -33,7 +33,7 @@ export function ReadmePanelContent({ detail, title, closeButton }: ReadmePanelCo
if (isLoading) {
readmeContent = (
<div className="flex h-40 items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
} else if (error) {
diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx
index 01efa92fcbc..d36315362e8 100644
--- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx
+++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx
@@ -15,8 +15,8 @@ vi.mock('@/service/use-plugins', () => ({
useInstalledPluginList: () => mockInstalledPluginList,
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div data-testid="loading">loading</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div data-testid="loading">loading</div>,
}))
vi.mock('@/app/components/plugins/marketplace/search-box', () => ({
diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx
index 4a885bd562f..25d776e4930 100644
--- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx
+++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx
@@ -7,7 +7,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/pop
import * as React from 'react'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import SearchBox from '@/app/components/plugins/marketplace/search-box'
import { useInstalledPluginList } from '@/service/use-plugins'
import { PLUGIN_TYPE_SEARCH_MAP } from '../../marketplace/constants'
@@ -98,7 +98,7 @@ const ToolPicker: FC<Props> = ({
const loadingContent = (
<div className="flex h-99 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
diff --git a/web/app/components/rag-pipeline/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/__tests__/index.spec.tsx
index 0a9606660ca..0f5e20c1566 100644
--- a/web/app/components/rag-pipeline/__tests__/index.spec.tsx
+++ b/web/app/components/rag-pipeline/__tests__/index.spec.tsx
@@ -77,7 +77,7 @@ describe('RagPipeline', () => {
render(<RagPipelineWrapper />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('passes initialized graph data to the pipeline', () => {
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/result/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/result/index.tsx
index 0bafc93fc45..977905dbc5f 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/result/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/result/index.tsx
@@ -1,5 +1,5 @@
import { memo, useState } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import ResultPanel from '@/app/components/workflow/run/result-panel'
import TracingPanel from '@/app/components/workflow/run/tracing-panel'
import { useStore } from '@/app/components/workflow/store'
@@ -50,7 +50,7 @@ const Result = () => {
)}
{currentTab === 'DETAIL' && !workflowRunningData?.result && (
<div className="flex grow items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{currentTab === 'TRACING' && (
@@ -61,7 +61,7 @@ const Result = () => {
)}
{currentTab === 'TRACING' && !workflowRunningData?.tracing?.length && (
<div className="flex grow items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/app/components/rag-pipeline/index.tsx b/web/app/components/rag-pipeline/index.tsx
index 75c7e9bdfc8..4da5b82ee16 100644
--- a/web/app/components/rag-pipeline/index.tsx
+++ b/web/app/components/rag-pipeline/index.tsx
@@ -1,6 +1,6 @@
import type { InjectWorkflowStoreSliceFn } from '@/app/components/workflow/store'
import { useMemo } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import WorkflowWithDefaultContext from '@/app/components/workflow'
import { WorkflowContextProvider } from '@/app/components/workflow/context'
import { initialEdges, initialNodes } from '@/app/components/workflow/utils'
@@ -27,7 +27,7 @@ const RagPipeline = () => {
if (!data || isLoading) {
return (
<div className="relative flex size-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/share/text-generation/__tests__/index.spec.tsx b/web/app/components/share/text-generation/__tests__/index.spec.tsx
index a19d1190bb6..855b5f92300 100644
--- a/web/app/components/share/text-generation/__tests__/index.spec.tsx
+++ b/web/app/components/share/text-generation/__tests__/index.spec.tsx
@@ -40,8 +40,8 @@ vi.mock('@/next/navigation', () => ({
}),
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: ({ type }: { type: string }) => <div data-testid="loading-app">{type}</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div role="progressbar" aria-label="Loading app" />,
}))
vi.mock('../hooks/use-text-generation-app-state', () => ({
@@ -170,7 +170,7 @@ describe('TextGeneration', () => {
render(<TextGeneration />)
- expect(screen.getByTestId('loading-app')).toHaveTextContent('app')
+ expect(screen.getByRole('progressbar', { name: 'Loading app' })).toBeInTheDocument()
})
it('should fall back to create mode for unsupported query params', () => {
diff --git a/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx b/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx
index c31388f758b..8d38aceed63 100644
--- a/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx
+++ b/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx
@@ -162,7 +162,7 @@ describe('TextGenerationResultPanel', () => {
expect(
screen.getByRole('button', { name: 'share.generation.batchFailed.retry' }),
)!.toBeInTheDocument()
- expect(screen.getByRole('status', { name: 'appApi.loading' }))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' }))!.toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'share.generation.batchFailed.retry' }))
expect(handleRetryAllFailedTask).toHaveBeenCalledTimes(1)
diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx
index 2f3c9307c88..be82e474cd5 100644
--- a/web/app/components/share/text-generation/index.tsx
+++ b/web/app/components/share/text-generation/index.tsx
@@ -7,7 +7,7 @@ import { toast } from '@langgenius/dify-ui/toast'
import { useBoolean } from 'ahooks'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { useSearchParams } from '@/next/navigation'
import { useTextGenerationAppState } from './hooks/use-text-generation-app-state'
@@ -123,7 +123,7 @@ const TextGeneration: FC<IMainProps> = ({ isInstalledApp = false, isWorkflow = f
if (!appId || !siteInfo || !promptConfig) {
return (
<div className="flex h-screen items-center">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
diff --git a/web/app/components/share/text-generation/result/__tests__/index.spec.tsx b/web/app/components/share/text-generation/result/__tests__/index.spec.tsx
index 5e6e8d6f3a6..285cca94c49 100644
--- a/web/app/components/share/text-generation/result/__tests__/index.spec.tsx
+++ b/web/app/components/share/text-generation/result/__tests__/index.spec.tsx
@@ -175,7 +175,7 @@ describe('Result', () => {
)
expect(sendCompletionMessageMock).toHaveBeenCalledTimes(1)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeTruthy()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeTruthy()
await act(async () => {
completionHandlers?.onData('Hello', false, {
diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsx
index b208222bb24..1a39d3074d2 100644
--- a/web/app/components/share/text-generation/result/index.tsx
+++ b/web/app/components/share/text-generation/result/index.tsx
@@ -11,7 +11,7 @@ import { useCallback } from 'react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import TextGenerationRes from '@/app/components/app/text-generate/item'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import NoData from '@/app/components/share/text-generation/no-data'
import { useResultRunState } from './hooks/use-result-run-state'
import { useResultSender } from './hooks/use-result-sender'
@@ -160,7 +160,7 @@ const Result: FC<IResultProps> = ({
!isWorkflow &&
(runState.isResponding && !runState.completionRes ? (
<div className="flex size-full items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
) : (
<>{isNoData ? <NoData /> : renderTextGenerationRes()}</>
@@ -169,7 +169,7 @@ const Result: FC<IResultProps> = ({
isWorkflow &&
(runState.isResponding && !runState.workflowProcessData ? (
<div className="flex size-full items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
) : !runState.workflowProcessData ? (
<NoData />
diff --git a/web/app/components/share/text-generation/text-generation-result-panel.tsx b/web/app/components/share/text-generation/text-generation-result-panel.tsx
index 226cea1a341..69c378306b4 100644
--- a/web/app/components/share/text-generation/text-generation-result-panel.tsx
+++ b/web/app/components/share/text-generation/text-generation-result-panel.tsx
@@ -6,7 +6,7 @@ import type { AppSourceType } from '@/service/share'
import type { VisionFile, VisionSettings } from '@/types/app'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import Res from '@/app/components/share/text-generation/result'
import ResDownload from './run-batch/res-download'
import { TaskStatus } from './types'
@@ -170,7 +170,7 @@ const TextGenerationResultPanel: FC<TextGenerationResultPanelProps> = ({
{isCallBatchAPI ? showTaskList.map((task) => renderResult(task)) : renderResult()}
{!noPendingTask && (
<div className="mt-4">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/app/components/snippets/__tests__/index.spec.tsx b/web/app/components/snippets/__tests__/index.spec.tsx
index 1f34fd474ab..a168799ac86 100644
--- a/web/app/components/snippets/__tests__/index.spec.tsx
+++ b/web/app/components/snippets/__tests__/index.spec.tsx
@@ -209,7 +209,7 @@ describe('SnippetPage', () => {
render(<SnippetPage snippetId="missing-snippet" />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('should keep the detail route shell while orchestrate data is loading', () => {
@@ -220,7 +220,7 @@ describe('SnippetPage', () => {
render(<SnippetPage snippetId="snippet-1" />)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
expect(screen.queryByRole('main')).not.toBeInTheDocument()
})
})
diff --git a/web/app/components/snippets/components/snippet-run-panel.tsx b/web/app/components/snippets/components/snippet-run-panel.tsx
index 919071c9ae7..f6f1631ce09 100644
--- a/web/app/components/snippets/components/snippet-run-panel.tsx
+++ b/web/app/components/snippets/components/snippet-run-panel.tsx
@@ -11,7 +11,7 @@ import { useTranslation } from 'react-i18next'
import { useStore as useReactFlowStore } from 'reactflow'
import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input-forms-hooks'
import { getProcessedInputs } from '@/app/components/base/chat/chat/utils'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import ResizeHandle from '@/app/components/base/resize-handle'
import { useWorkflowInteractions } from '@/app/components/workflow/hooks/use-workflow-panel-interactions'
import { useWorkflowRun } from '@/app/components/workflow/hooks/use-workflow-run'
@@ -278,7 +278,7 @@ const SnippetRunPanel = ({ fields }: SnippetRunPanelProps) => {
)}
{currentTab === 'DETAIL' && !workflowRunningData?.result && (
<div className="flex h-full items-center justify-center bg-components-panel-bg">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{currentTab === 'TRACING' && (
@@ -289,7 +289,7 @@ const SnippetRunPanel = ({ fields }: SnippetRunPanelProps) => {
)}
{currentTab === 'TRACING' && !workflowRunningData?.tracing?.length && (
<div className="flex h-full items-center justify-center bg-background-section-burn!">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/app/components/snippets/index.tsx b/web/app/components/snippets/index.tsx
index 1d453d3f826..fb4d0833b59 100644
--- a/web/app/components/snippets/index.tsx
+++ b/web/app/components/snippets/index.tsx
@@ -1,7 +1,7 @@
'use client'
import { useMemo } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import WorkflowWithDefaultContext from '@/app/components/workflow'
import { WorkflowContextProvider } from '@/app/components/workflow/context'
import { initialEdges, initialNodes } from '@/app/components/workflow/utils'
@@ -17,7 +17,7 @@ const SnippetPageLoading = ({ snippetId }: SnippetPageProps) => {
return (
<SnippetLayout snippetId={snippetId} section="orchestrate">
<div className="flex h-full items-center justify-center bg-background-body">
- <Loading />
+ <LoadingPlaceholder />
</div>
</SnippetLayout>
)
diff --git a/web/app/components/tools/marketplace/__tests__/index.spec.tsx b/web/app/components/tools/marketplace/__tests__/index.spec.tsx
index 5c46a9d78ba..e49901b3012 100644
--- a/web/app/components/tools/marketplace/__tests__/index.spec.tsx
+++ b/web/app/components/tools/marketplace/__tests__/index.spec.tsx
@@ -137,7 +137,7 @@ describe('Marketplace', () => {
)
// Assert
- expect(document.querySelector('svg.spin-animation')).toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).toBeInTheDocument()
expect(screen.queryByTestId('marketplace-list')).not.toBeInTheDocument()
})
diff --git a/web/app/components/tools/marketplace/index.tsx b/web/app/components/tools/marketplace/index.tsx
index e78ab9e3bc3..64c9747e9a7 100644
--- a/web/app/components/tools/marketplace/index.tsx
+++ b/web/app/components/tools/marketplace/index.tsx
@@ -6,7 +6,7 @@ import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTheme } from 'next-themes'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import List from '@/app/components/plugins/marketplace/list'
import { usePluginSettingsAccess } from '@/app/components/plugins/plugin-page/use-reference-setting'
import { useRouter } from '@/next/navigation'
@@ -116,7 +116,7 @@ const Marketplace = ({
<div className="-mt-3.5 shrink-0 grow bg-background-default-subtle pb-2">
{isLoading && page === 1 && (
<div className="absolute top-1/2 left-1/2 -translate-1/2">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{(!isLoading || page > 1) && (
diff --git a/web/app/components/tools/provider/__tests__/detail.spec.tsx b/web/app/components/tools/provider/__tests__/detail.spec.tsx
index ae93482e93e..ce7e0c34d6f 100644
--- a/web/app/components/tools/provider/__tests__/detail.spec.tsx
+++ b/web/app/components/tools/provider/__tests__/detail.spec.tsx
@@ -343,7 +343,7 @@ describe('ProviderDetail', () => {
onRefreshData={mockOnRefreshData}
/>,
)
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar'))!.toBeInTheDocument()
})
it('renders tool list after loading for builtIn type', async () => {
diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx
index a26fcadd0bf..4dd22f1ea29 100644
--- a/web/app/components/tools/provider/detail.tsx
+++ b/web/app/components/tools/provider/detail.tsx
@@ -35,7 +35,7 @@ import * as React from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { ConfigurationMethodEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import Icon from '@/app/components/plugins/card/base/card-icon'
import Description from '@/app/components/plugins/card/base/description'
@@ -377,7 +377,7 @@ const ProviderDetail = ({ collection, onHide, onRefreshData }: Props) => {
<div className="flex min-h-0 flex-1 flex-col pt-3">
{isDetailLoading && (
<div className="flex h-50">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
{!isDetailLoading && (
diff --git a/web/app/components/tools/setting/build-in/__tests__/config-credentials.spec.tsx b/web/app/components/tools/setting/build-in/__tests__/config-credentials.spec.tsx
index 7b5aa96e5cb..082e4644423 100644
--- a/web/app/components/tools/setting/build-in/__tests__/config-credentials.spec.tsx
+++ b/web/app/components/tools/setting/build-in/__tests__/config-credentials.spec.tsx
@@ -86,7 +86,7 @@ describe('ConfigCredential', () => {
onSaved={mockOnSaved}
/>,
)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
await waitFor(() => {
expect(screen.getByTestId('form')).toBeInTheDocument()
diff --git a/web/app/components/tools/setting/build-in/config-credentials.tsx b/web/app/components/tools/setting/build-in/config-credentials.tsx
index 84deb53f890..632e3f39c55 100644
--- a/web/app/components/tools/setting/build-in/config-credentials.tsx
+++ b/web/app/components/tools/setting/build-in/config-credentials.tsx
@@ -20,7 +20,7 @@ import * as React from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { LinkExternal02 } from '@/app/components/base/icons/src/vender/line/general'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form'
import { fetchBuiltInToolCredential, fetchBuiltInToolCredentialSchema } from '@/service/tools'
@@ -113,7 +113,7 @@ const ConfigCredential: FC<Props> = ({
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
{!credentialSchema ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : (
<>
<Form
diff --git a/web/app/components/workflow-app/__tests__/index.spec.tsx b/web/app/components/workflow-app/__tests__/index.spec.tsx
index 0c3acc2749c..2b1339bc5dc 100644
--- a/web/app/components/workflow-app/__tests__/index.spec.tsx
+++ b/web/app/components/workflow-app/__tests__/index.spec.tsx
@@ -150,8 +150,8 @@ vi.mock('@/app/components/workflow/utils', async (importOriginal) => {
}
})
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div data-testid="loading">loading</div>,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div data-testid="loading">loading</div>,
}))
vi.mock('@/app/components/base/features', () => ({
diff --git a/web/app/components/workflow-app/index.tsx b/web/app/components/workflow-app/index.tsx
index 47e0b4cd696..9efdec89437 100644
--- a/web/app/components/workflow-app/index.tsx
+++ b/web/app/components/workflow-app/index.tsx
@@ -7,7 +7,7 @@ import { useAtomValue } from 'jotai'
import { useEffect, useMemo } from 'react'
import { useStore as useAppStore } from '@/app/components/app/store'
import { FeaturesProvider } from '@/app/components/base/features'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import WorkflowWithDefaultContext from '@/app/components/workflow'
import { WorkflowContextProvider } from '@/app/components/workflow/context'
import { useWorkflowStore } from '@/app/components/workflow/store'
@@ -116,7 +116,7 @@ const WorkflowAppWithAdditionalContext = () => {
if (!data || isLoading || isLoadingCurrentWorkspace || !currentWorkspace.id) {
return (
<div className="relative flex size-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/workflow/block-selector/featured-tools.tsx b/web/app/components/workflow/block-selector/featured-tools.tsx
index 5033200444c..0c20b74f699 100644
--- a/web/app/components/workflow/block-selector/featured-tools.tsx
+++ b/web/app/components/workflow/block-selector/featured-tools.tsx
@@ -15,7 +15,7 @@ import {
} from '@langgenius/dify-ui/preview-card'
import { useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { PluginInstallPermissionProvider } from '@/app/components/plugins/install-plugin/components/plugin-install-permission-provider'
import useWorkspacePluginInstallPermission from '@/app/components/plugins/install-plugin/hooks/use-workspace-plugin-install-permission'
import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace'
@@ -138,7 +138,7 @@ const FeaturedTools = ({
<CollapsiblePanel>
{isLoading && (
<div className="py-3">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
diff --git a/web/app/components/workflow/block-selector/featured-triggers.tsx b/web/app/components/workflow/block-selector/featured-triggers.tsx
index edc21899a38..dd054f391bb 100644
--- a/web/app/components/workflow/block-selector/featured-triggers.tsx
+++ b/web/app/components/workflow/block-selector/featured-triggers.tsx
@@ -15,7 +15,7 @@ import {
} from '@langgenius/dify-ui/preview-card'
import { useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { PluginInstallPermissionProvider } from '@/app/components/plugins/install-plugin/components/plugin-install-permission-provider'
import useWorkspacePluginInstallPermission from '@/app/components/plugins/install-plugin/hooks/use-workspace-plugin-install-permission'
import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace'
@@ -142,7 +142,7 @@ const FeaturedTriggers = ({
<CollapsiblePanel>
{isLoading && (
<div className="py-3">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
diff --git a/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx b/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx
index c8efc2fb768..93ac005d6e6 100644
--- a/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx
+++ b/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx
@@ -5,7 +5,7 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useMemo } from 'react'
import { Trans, useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { getFormattedPlugin } from '@/app/components/plugins/marketplace/utils'
import { useRAGRecommendationsCollapsed } from '@/app/components/workflow/block-selector/storage'
import Link from '@/next/link'
@@ -68,7 +68,7 @@ export function RAGToolRecommendations({
{/* For first time loading, show loading */}
{isLoadingRAGRecommendedPlugins && (
<div className="py-2">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)}
{!isFetchingRAGRecommendedPlugins &&
diff --git a/web/app/components/workflow/block-selector/snippets/index.tsx b/web/app/components/workflow/block-selector/snippets/index.tsx
index 611838abb23..ec1d7431d71 100644
--- a/web/app/components/workflow/block-selector/snippets/index.tsx
+++ b/web/app/components/workflow/block-selector/snippets/index.tsx
@@ -17,7 +17,7 @@ import {
import { useInfiniteScroll } from 'ahooks'
import { memo, useCallback, useDeferredValue, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useInfiniteSnippetList } from '@/service/use-snippets'
import { BlockSelectorPreviewCardContent } from '../preview-card'
import SnippetDetailCard from './snippet-detail-card'
@@ -175,7 +175,7 @@ const Snippets = ({ searchText, onSearchTextChange, insertPayload, onInserted }:
})}
{isFetchingNextPage && (
<div className="flex justify-center px-3 py-2">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</ScrollAreaContent>
diff --git a/web/app/components/workflow/header/__tests__/view-history.spec.tsx b/web/app/components/workflow/header/__tests__/view-history.spec.tsx
index 46233c0ecfd..b4663317088 100644
--- a/web/app/components/workflow/header/__tests__/view-history.spec.tsx
+++ b/web/app/components/workflow/header/__tests__/view-history.spec.tsx
@@ -56,8 +56,8 @@ vi.mock('@/app/components/rag-pipeline/hooks/use-input-field-panel', () => ({
}),
}))
-vi.mock('@/app/components/base/loading', () => ({
- default: () => <div data-testid="loading" />,
+vi.mock('@/app/components/base/loading-placeholder', () => ({
+ LoadingPlaceholder: () => <div data-testid="loading" />,
}))
vi.mock('@langgenius/dify-ui/toast', () => ({
diff --git a/web/app/components/workflow/header/view-history.tsx b/web/app/components/workflow/header/view-history.tsx
index 4e48bfa6c0e..52e4886387e 100644
--- a/web/app/components/workflow/header/view-history.tsx
+++ b/web/app/components/workflow/header/view-history.tsx
@@ -3,7 +3,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/pop
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { memo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks/use-input-field-panel'
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
@@ -105,7 +105,7 @@ const ViewHistory = ({ withText, onClearLogAndMessageModal, historyUrl }: ViewHi
</div>
{isLoading && (
<div className="flex h-10 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{!isLoading && (
diff --git a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx
index c6556ef549e..75f436129bd 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx
@@ -579,7 +579,7 @@ describe('WorkflowInlineAgentConfigureWorkspace', () => {
/>,
)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.queryByRole('region', { name: 'orchestrate-panel' })).not.toBeInTheDocument()
await waitFor(() => expect(mocks.loadBuildDraft).toHaveBeenCalledTimes(1))
})
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx
index dbf79e57b25..42a260ca554 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx
@@ -22,7 +22,7 @@ import { useAtom, useAtomValue, useStore as useJotaiStore, useSetAtom } from 'jo
import { ScopeProvider } from 'jotai-scope'
import { useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import {
useDefaultModel,
@@ -123,7 +123,7 @@ export function WorkflowRosterAgentOrchestratePanelContent(
if (!agentId || !agentSoulConfig) {
return (
<div className="flex h-full min-h-80 items-center justify-center bg-components-panel-bg">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
@@ -196,7 +196,7 @@ export function WorkflowInlineAgentConfigureWorkspace(
if (!agentId) {
return (
<div className="flex h-full min-h-80 items-center justify-center bg-components-panel-bg">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
@@ -247,7 +247,7 @@ function WorkflowInlineAgentConfigureWorkspaceComposerScope({
if (!agentSoulConfig || buildDraft.isPending) {
return (
<div className="flex h-full min-h-80 items-center justify-center bg-components-panel-bg">
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
</div>
)
}
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx
index 05c50d796cd..09d95b73325 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx
@@ -5,7 +5,7 @@ import { RiArrowLeftLine, RiCloseLine, RiSparklingLine } from '@remixicon/react'
import * as React from 'react'
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { getValidationErrorMessage, validateSchemaAgainstDraft7 } from '../../../utils'
import CodeEditor from '../code-editor'
import ErrorMessage from '../error-message'
@@ -59,7 +59,7 @@ const GeneratedResult: FC<GeneratedResultProps> = ({
<div className="flex w-120 flex-col rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-2xl shadow-shadow-shadow-9">
{isGenerating ? (
<div className="flex h-150 flex-col items-center justify-center gap-y-3">
- <Loading type="area" />
+ <LoadingPlaceholder />
<div className="system-xs-regular text-text-tertiary">
{t(($) => $['nodes.llm.jsonSchema.generating'], { ns: 'workflow' })}
</div>
diff --git a/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx
index 7b461533d04..6ea8227d6c7 100644
--- a/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx
+++ b/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx
@@ -195,7 +195,7 @@ describe('ToolPanel', () => {
renderPanel()
- expect(screen.getByRole('status'))!.toBeInTheDocument()
+ expect(screen.getByRole('progressbar'))!.toBeInTheDocument()
expect(screen.queryByText('workflow.nodes.tool.inputVars')).not.toBeInTheDocument()
expect(mockToolForm).not.toHaveBeenCalled()
})
diff --git a/web/app/components/workflow/nodes/tool/panel.tsx b/web/app/components/workflow/nodes/tool/panel.tsx
index 1f0be3c97a6..79d71b68814 100644
--- a/web/app/components/workflow/nodes/tool/panel.tsx
+++ b/web/app/components/workflow/nodes/tool/panel.tsx
@@ -3,7 +3,7 @@ import type { ToolNodeType } from './types'
import type { NodePanelProps } from '@/app/components/workflow/types'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
import StructureOutputItem from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show'
@@ -44,7 +44,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({ id, data }) => {
if (isLoading) {
return (
<div className="flex h-50 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/app/components/workflow/panel/__tests__/workflow-preview.spec.tsx b/web/app/components/workflow/panel/__tests__/workflow-preview.spec.tsx
index ab7b2941323..d140c428f4b 100644
--- a/web/app/components/workflow/panel/__tests__/workflow-preview.spec.tsx
+++ b/web/app/components/workflow/panel/__tests__/workflow-preview.spec.tsx
@@ -308,7 +308,7 @@ describe('WorkflowPreview', () => {
},
})
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
})
it('should show a loading state for an empty tracing panel', () => {
@@ -321,7 +321,7 @@ describe('WorkflowPreview', () => {
})
expect(screen.getByTestId('tracing-panel')).toHaveTextContent('0')
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
})
it('should keep inert tabs disabled without run data and switch among result, detail, and tracing when data exists', async () => {
diff --git a/web/app/components/workflow/panel/chat-record/index.tsx b/web/app/components/workflow/panel/chat-record/index.tsx
index 4966c720a55..ce39d4d9643 100644
--- a/web/app/components/workflow/panel/chat-record/index.tsx
+++ b/web/app/components/workflow/panel/chat-record/index.tsx
@@ -6,7 +6,7 @@ import { useStore as useAppStore } from '@/app/components/app/store'
import Chat from '@/app/components/base/chat/chat'
import { buildChatItemTree, getThreadMessages } from '@/app/components/base/chat/utils'
import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { fetchConversationMessages } from '@/service/debug'
import { useWorkflowRun } from '../../hooks/use-workflow-run'
import { useStore, useWorkflowStore } from '../../store'
@@ -95,7 +95,7 @@ const ChatRecord = () => {
>
{!fetched && (
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{fetched && (
diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsx
index 9a2f472a873..6de42cc9282 100644
--- a/web/app/components/workflow/panel/workflow-preview.tsx
+++ b/web/app/components/workflow/panel/workflow-preview.tsx
@@ -7,7 +7,7 @@ import { memo, useCallback, useEffect, useId, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore as useReactFlowStore } from 'reactflow'
import ReasoningPanel from '@/app/components/base/chat/chat/answer/reasoning-panel'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import ResizeHandle from '@/app/components/base/resize-handle'
import { submitHumanInputForm } from '@/service/workflow'
import { useWorkflowInteractions } from '../hooks/use-workflow-panel-interactions'
@@ -273,7 +273,7 @@ const WorkflowPreview = () => {
)}
{currentTab === 'DETAIL' && !workflowRunningData?.result && (
<div className="flex h-full items-center justify-center bg-components-panel-bg">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{currentTab === 'TRACING' && (
@@ -284,7 +284,7 @@ const WorkflowPreview = () => {
)}
{currentTab === 'TRACING' && !workflowRunningData?.tracing?.length && (
<div className="flex h-full items-center justify-center bg-background-section-burn!">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/app/components/workflow/run/index.tsx b/web/app/components/workflow/run/index.tsx
index 1c05f61732c..9e77b1d6b3b 100644
--- a/web/app/components/workflow/run/index.tsx
+++ b/web/app/components/workflow/run/index.tsx
@@ -6,7 +6,7 @@ import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
import { toast } from '@langgenius/dify-ui/toast'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
import { fetchRunDetail, fetchTracingList } from '@/service/log'
import { useStore } from '../store'
@@ -145,7 +145,7 @@ const RunPanel: FC<RunProps> = ({
>
{loading && (
<div className="flex h-full items-center justify-center bg-components-panel-bg">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
<TabsPanel value="RESULT">
diff --git a/web/app/components/workflow/variable-inspect/right.tsx b/web/app/components/workflow/variable-inspect/right.tsx
index 72274e26320..c34c683ecd0 100644
--- a/web/app/components/workflow/variable-inspect/right.tsx
+++ b/web/app/components/workflow/variable-inspect/right.tsx
@@ -11,7 +11,7 @@ import { useTranslation } from 'react-i18next'
import GetAutomaticResModal from '@/app/components/app/configuration/config/automatic/get-automatic-res'
import Badge from '@/app/components/base/badge'
import { CopyFeedback } from '@/app/components/base/copy-feedback'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import BlockIcon from '@/app/components/workflow/block-icon'
import { VariableIconWithColor } from '@/app/components/workflow/nodes/_base/components/variable/variable-label'
import { useEventEmitterContextContext } from '@/context/event-emitter'
@@ -315,7 +315,7 @@ const Right = ({ nodeId, currentNodeVar, handleOpenMenu, isValueFetching }: Prop
{!currentNodeVar?.var && <Empty />}
{isValueFetching && (
<div className="flex h-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
{currentNodeVar?.var && !isValueFetching && (
diff --git a/web/app/education/apply/institution-field.tsx b/web/app/education/apply/institution-field.tsx
index 4e510fceb99..800d9a5a723 100644
--- a/web/app/education/apply/institution-field.tsx
+++ b/web/app/education/apply/institution-field.tsx
@@ -14,12 +14,12 @@ import {
AutocompleteStatus,
} from '@langgenius/dify-ui/autocomplete'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
+import { SpinnerIcon } from '@langgenius/dify-ui/spinner'
import { keepPreviousData, useInfiniteQuery } from '@tanstack/react-query'
import { useDebouncedValue } from 'foxact/use-debounced-value'
import { useId, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { InfiniteScrollSentinel } from '@/app/components/base/infinite-scroll-sentinel'
-import Loading from '@/app/components/base/loading'
import { consoleQuery } from '@/service/console'
const EDUCATION_AUTOCOMPLETE_PAGE_SIZE = 40
@@ -138,7 +138,7 @@ const InstitutionField = ({ value, onValueChange }: InstitutionFieldProps) => {
{t(($) => $['dynamicSelect.error'], { ns: 'common' })}
</span>
) : (
- <Loading className="h-10" />
+ <SpinnerIcon />
)}
</div>
) : null}
diff --git a/web/app/education/verify/verify-flow.tsx b/web/app/education/verify/verify-flow.tsx
index 11b7d8b0ef5..360a5e18631 100644
--- a/web/app/education/verify/verify-flow.tsx
+++ b/web/app/education/verify/verify-flow.tsx
@@ -7,7 +7,7 @@ import { Button, buttonVariants } from '@langgenius/dify-ui/button'
import { useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query'
import { useCallback, useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useDocLink } from '@/context/i18n'
import { userProfileQueryOptions } from '@/features/account-profile/client'
import Link from '@/next/link'
@@ -187,7 +187,7 @@ function EducationVerifyContent({ children }: { children: ReactNode }) {
function EducationVerifyLoading() {
return (
<EducationStatusCard
- icon={<Loading />}
+ icon={<LoadingPlaceholder />}
title={<span className="block h-5 w-40 animate-pulse rounded bg-background-section-burn" />}
>
<span className="block h-4 w-full max-w-100 animate-pulse rounded bg-background-section-burn" />
diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsx
index dff1204a09f..71a8040b5ff 100644
--- a/web/app/forgot-password/ChangePasswordForm.tsx
+++ b/web/app/forgot-password/ChangePasswordForm.tsx
@@ -13,7 +13,7 @@ import { Form } from '@langgenius/dify-ui/form'
import { Input } from '@langgenius/dify-ui/input'
import { useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { validPassword } from '@/config'
import useDocumentTitle from '@/hooks/use-document-title'
import { useSearchParams } from '@/next/navigation'
@@ -78,7 +78,7 @@ const ChangePasswordForm = () => {
<div
className={cn('flex w-full grow flex-col items-center justify-center', 'px-6', 'md:px-27')}
>
- {isVerifyingToken && <Loading />}
+ {isVerifyingToken && <LoadingPlaceholder />}
{isTokenInvalid && (
<div className="flex flex-col md:w-100">
<div className="mx-auto w-full">
diff --git a/web/app/forgot-password/ForgotPasswordForm.tsx b/web/app/forgot-password/ForgotPasswordForm.tsx
index 21b128af43e..79c9e402bb6 100644
--- a/web/app/forgot-password/ForgotPasswordForm.tsx
+++ b/web/app/forgot-password/ForgotPasswordForm.tsx
@@ -8,6 +8,7 @@ import { Input } from '@langgenius/dify-ui/input'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import * as z from 'zod'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useDocumentTitle from '@/hooks/use-document-title'
import Link from '@/next/link'
import {
@@ -16,7 +17,6 @@ import {
sendForgotPasswordEmail,
} from '@/service/common'
import { basePath } from '@/utils/var'
-import Loading from '../components/base/loading'
type ForgotPasswordFormValues = {
email: string
@@ -67,7 +67,7 @@ const ForgotPasswordForm = () => {
}, [])
return loading ? (
- <Loading />
+ <LoadingPlaceholder />
) : (
<>
<div className="sm:mx-auto sm:w-full sm:max-w-md">
diff --git a/web/app/init/InitPasswordPopup.tsx b/web/app/init/InitPasswordPopup.tsx
index bc79d49f2a7..a7a24a6af7d 100644
--- a/web/app/init/InitPasswordPopup.tsx
+++ b/web/app/init/InitPasswordPopup.tsx
@@ -4,11 +4,11 @@ import { Button } from '@langgenius/dify-ui/button'
import { toast } from '@langgenius/dify-ui/toast'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useDocumentTitle from '@/hooks/use-document-title'
import { useRouter } from '@/next/navigation'
import { fetchInitValidateStatus, initValidate } from '@/service/common'
import { basePath } from '@/utils/var'
-import Loading from '../components/base/loading'
const InitPasswordPopup = () => {
const [password, setPassword] = useState('')
@@ -44,7 +44,7 @@ const InitPasswordPopup = () => {
}, [])
return loading ? (
- <Loading />
+ <LoadingPlaceholder />
) : (
<div>
{!validated && (
diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx
index 9c87efa4374..85a9bca2e41 100644
--- a/web/app/install/installForm.tsx
+++ b/web/app/install/installForm.tsx
@@ -18,6 +18,7 @@ import * as React from 'react'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import * as z from 'zod'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { validPassword } from '@/config'
import { LICENSE_LINK } from '@/constants/link'
import useDocumentTitle from '@/hooks/use-document-title'
@@ -26,7 +27,6 @@ import { useRouter } from '@/next/navigation'
import { fetchInitValidateStatus, fetchSetupStatus, login, setup } from '@/service/common'
import { consoleQuery } from '@/service/console'
import { encryptPassword as encodePassword } from '@/utils/encryption'
-import Loading from '../components/base/loading'
const accountFormSchema = zPostSetupBody.pick({ email: true, name: true, password: true }).extend({
email: zPostSetupBody.shape.email.pipe(z.email()),
@@ -95,7 +95,7 @@ const InstallForm = () => {
}, [push])
return loading ? (
- <Loading />
+ <LoadingPlaceholder />
) : (
<>
<div className="sm:mx-auto sm:w-full sm:max-w-md">
diff --git a/web/app/signin/invite-settings/page.tsx b/web/app/signin/invite-settings/page.tsx
index 19b11b0198a..1d891a7d8e7 100644
--- a/web/app/signin/invite-settings/page.tsx
+++ b/web/app/signin/invite-settings/page.tsx
@@ -18,7 +18,7 @@ import { useQuery, useQueryClient, useSuspenseQuery } from '@tanstack/react-quer
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { LICENSE_LINK } from '@/constants/link'
import { isLegacyBase401, userProfileQueryOptions } from '@/features/account-profile/client'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
@@ -183,7 +183,7 @@ export default function InviteSettingsPage() {
router,
])
- if (isProfilePending || shouldReturnToSignIn || !checkRes) return <Loading />
+ if (isProfilePending || shouldReturnToSignIn || !checkRes) return <LoadingPlaceholder />
if (!checkRes.is_valid) {
return (
<div className="flex flex-col md:w-100">
diff --git a/web/app/signin/normal-form.tsx b/web/app/signin/normal-form.tsx
index 7db9b968331..fc28e790240 100644
--- a/web/app/signin/normal-form.tsx
+++ b/web/app/signin/normal-form.tsx
@@ -5,6 +5,7 @@ import { RiContractLine, RiDoorLockLine, RiErrorWarningFill } from '@remixicon/r
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { isLegacyBase401, userProfileQueryOptions } from '@/features/account-profile/client'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import Link from '@/next/link'
@@ -12,7 +13,6 @@ import { useRouter, useSearchParams } from '@/next/navigation'
import { invitationCheck } from '@/service/common'
import { replaceLoginRedirect } from '@/utils/login-redirect.client'
import { basePath } from '@/utils/var'
-import Loading from '../components/base/loading'
import MailAndCodeAuth from './components/mail-and-code-auth'
import MailAndPasswordAuth from './components/mail-and-password-auth'
import SocialAuth from './components/social-auth'
@@ -116,7 +116,7 @@ function NormalForm() {
<div
className={cn('flex w-full grow flex-col items-center justify-center', 'px-6', 'md:px-27')}
>
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/context/web-app-context.tsx b/web/context/web-app-context.tsx
index 8b224417be6..0b4073b0b94 100644
--- a/web/context/web-app-context.tsx
+++ b/web/context/web-app-context.tsx
@@ -11,7 +11,7 @@ import {
resolveWebAppLoginRedirect,
} from '@/app/(shareLayout)/webapp-signin/login-redirect'
import { getProcessedSystemVariablesFromUrlParams } from '@/app/components/base/chat/utils'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { AccessMode } from '@/models/access-control'
import { usePathname, useSearchParams } from '@/next/navigation'
@@ -115,7 +115,7 @@ const WebAppStoreProvider: FC<PropsWithChildren> = ({ children }) => {
if (isLoading) {
return (
<div className="flex size-full items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx b/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx
index d6f259ab62f..093962482b8 100644
--- a/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx
+++ b/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx
@@ -640,7 +640,9 @@ describe('AgentConfigurePage', () => {
})
expect(configureSection).toHaveAttribute('aria-busy', 'true')
expect(configureSection).toHaveClass('bg-background-body')
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(
+ screen.getByRole('progressbar', { name: 'agentV2.agentDetail.sections.configure' }),
+ ).toBeInTheDocument()
expect(screen.queryByRole('region', { name: 'orchestrate-panel' })).not.toBeInTheDocument()
expect(
vi
@@ -685,7 +687,9 @@ describe('AgentConfigurePage', () => {
{ searchParams: '?mode=build' },
)
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(
+ screen.getByRole('progressbar', { name: 'agentV2.agentDetail.sections.configure' }),
+ ).toBeInTheDocument()
expect(screen.queryByRole('region', { name: 'orchestrate-panel' })).not.toBeInTheDocument()
mocks.queryState.buildDraft = {
@@ -889,7 +893,9 @@ describe('AgentConfigurePage', () => {
'publish:yes',
)
expect(screen.getByRole('region', { name: 'build-chat' })).toHaveTextContent('build:none')
- expect(screen.queryByRole('status', { name: 'appApi.loading' })).not.toBeInTheDocument()
+ expect(
+ screen.queryByRole('progressbar', { name: 'agentV2.agentDetail.sections.configure' }),
+ ).not.toBeInTheDocument()
expect(screen.getByRole('button', { name: 'send build message' })).toBeDisabled()
refreshBuildConversation.resolve({
diff --git a/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx b/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx
index 2bbf7fc7bae..39d1f129eb6 100644
--- a/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx
@@ -14,7 +14,7 @@ import { useAtomValue, useSetAtom } from 'jotai'
import { ScopeProvider } from 'jotai-scope'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { agentSoulConfigToFormState } from '@/features/agent-v2/agent-composer/conversions'
import { AgentComposerProvider } from '@/features/agent-v2/agent-composer/provider'
import { rebaseAgentComposerDraftAtom } from '@/features/agent-v2/agent-composer/store'
@@ -552,7 +552,7 @@ function AgentConfigurePageComposerContent({
!(rightPanelMode === 'build'
? capabilities.canBuild
: previewEnabled) ? null : buildDraft.isPending ? (
- <Loading type="app" />
+ <LoadingPlaceholder className="h-full" />
) : (
<AgentConfigureRightPanelChat
agentId={agentId}
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
index c1cd7ef842e..2db44e9505f 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
@@ -19,7 +19,7 @@ import {
} from '@langgenius/dify-ui/scroll-area'
import { useCallback, useId } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { AgentFileTree } from '../files/tree'
type AgentSkillFileNode = AgentFileNode
@@ -109,7 +109,7 @@ function AgentSkillFileList({
</h3>
)}
<div className="flex min-h-0 flex-1 items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
</div>
)
@@ -233,7 +233,7 @@ function AgentFilePreviewContent({
if (isLoading || isDownloadLoading) {
return (
<div className="flex min-h-40 flex-1 items-center justify-center">
- <Loading type="area" />
+ <LoadingPlaceholder />
</div>
)
}
diff --git a/web/features/agent-v2/agent-detail/configure/components/page-loading.tsx b/web/features/agent-v2/agent-detail/configure/components/page-loading.tsx
index dbd2d815e38..cdc7646ff3d 100644
--- a/web/features/agent-v2/agent-detail/configure/components/page-loading.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/page-loading.tsx
@@ -1,11 +1,11 @@
'use client'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
export function AgentConfigurePageLoading({ label }: { label: string }) {
return (
<section aria-label={label} aria-busy className="flex h-full min-w-0 flex-1 bg-background-body">
- <Loading type="app" />
+ <LoadingPlaceholder label={label} className="h-full" />
</section>
)
}
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx
index 8c7dec8d6e7..731ba2bebeb 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx
@@ -6,7 +6,7 @@ import type { AgentChatMessageSender, AgentPreviewChatController } from './chat-
import type { AnswerActionPosition } from '@/app/components/base/chat/chat/answer/operation'
import { skipToken, useQuery } from '@tanstack/react-query'
import { useCallback, useMemo, useState } from 'react'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { consoleQuery } from '@/service/console'
import { getFormattedAgentDebugChatTree } from './chat-history'
import { AgentPreviewChatSession } from './chat-session'
@@ -103,11 +103,7 @@ export function AgentChatRuntime({
[historyQuery.data?.data],
)
if (conversationId && historyQuery.isPending && !conversationBelongsToCurrentSession) {
- return (
- <div className="flex h-full items-center justify-center">
- <Loading type="app" />
- </div>
- )
+ return <LoadingPlaceholder className="h-full" />
}
const inputSessionKey =
!conversationId || conversationBelongsToCurrentSession ? 'current-session' : conversationId
diff --git a/web/features/agent-v2/agent-detail/layout.tsx b/web/features/agent-v2/agent-detail/layout.tsx
index 7ad6f3de0a0..2af828158f4 100644
--- a/web/features/agent-v2/agent-detail/layout.tsx
+++ b/web/features/agent-v2/agent-detail/layout.tsx
@@ -4,7 +4,7 @@ import type { ReactNode } from 'react'
import { Button } from '@langgenius/dify-ui/button'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { getAgentDefaultSection, getAgentSectionAccess } from '@/features/agent-v2/acl'
import { useAgentPermissions } from '@/features/agent-v2/permissions'
import useDocumentTitle from '@/hooks/use-document-title'
@@ -51,7 +51,7 @@ export function AgentDetailLayout({ agentId, children }: AgentDetailLayoutProps)
if (redirectPath) router.replace(redirectPath)
}, [router, redirectPath])
- if (agentQuery.isPending) return <Loading type="app" />
+ if (agentQuery.isPending) return <LoadingPlaceholder className="h-full" />
if (redirectPath) return null
if (agentQuery.isError) {
return (
diff --git a/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx b/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx
index 21d7f103001..f3158fc49eb 100644
--- a/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx
+++ b/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx
@@ -11,7 +11,7 @@ import { skipToken, useMutation, useQuery, useQueryClient } from '@tanstack/reac
import { useTranslation } from 'react-i18next'
import Chat from '@/app/components/base/chat/chat'
import CopyIcon from '@/app/components/base/copy-icon'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useTimestamp from '@/hooks/use-timestamp'
import { consoleQuery } from '@/service/console'
@@ -124,11 +124,7 @@ export function AgentLogDetailPanel({
<div className="rounded-t-xl bg-background-section-burn p-3 pb-2" />
</div>
<div className="mx-1 mb-1 grow overflow-auto rounded-b-xl bg-background-section-burn">
- {messagesQuery.isPending && (
- <div className="flex h-full items-center justify-center">
- <Loading />
- </div>
- )}
+ {messagesQuery.isPending && <LoadingPlaceholder className="h-full" />}
{messagesQuery.isError && (
<div className="flex h-full items-center justify-center text-center system-sm-regular text-text-tertiary">
{t(($) => $['agentDetail.logs.loadFailed'], { ns: 'agentV2' })}
diff --git a/web/features/new-rag/__tests__/add-source-page.spec.tsx b/web/features/new-rag/__tests__/add-source-page.spec.tsx
index 447dcb201ca..c8954647001 100644
--- a/web/features/new-rag/__tests__/add-source-page.spec.tsx
+++ b/web/features/new-rag/__tests__/add-source-page.spec.tsx
@@ -234,7 +234,7 @@ describe('AddSourcePage', () => {
})
expect(options.getNextPageParam({ items: [], nextCursor: 'next' })).toBe('next')
expect(options.initialPageParam).toBeNull()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('continues loading connection pages automatically', async () => {
@@ -561,7 +561,7 @@ describe('AddSourcePage', () => {
params: { id: 'space-1' },
}),
)
- await screen.findByRole('status', { name: 'appApi.loading' })
+ await screen.findByRole('progressbar', { name: 'appApi.loading' })
act(() => window.dispatchEvent(new PopStateEvent('popstate')))
expect(queryClientMock.invalidateQueries).toHaveBeenCalledWith({
queryKey: ['source-connections'],
@@ -595,7 +595,7 @@ describe('AddSourcePage', () => {
expect(clientMock.createConnection).toHaveBeenCalledOnce()
await act(async () => createConnectionDeferred.resolve(connection('active')))
- await screen.findByRole('status', { name: 'appApi.loading' })
+ await screen.findByRole('progressbar', { name: 'appApi.loading' })
})
it('releases the parent history guard before the crawl preview owns navigation', async () => {
@@ -681,7 +681,7 @@ describe('AddSourcePage', () => {
view.rerender(
<AddSourcePage initialSourceDraft={initialSourceDraft} knowledgeSpaceId="space-1" />,
)
- await screen.findByRole('status', { name: 'appApi.loading' })
+ await screen.findByRole('progressbar', { name: 'appApi.loading' })
act(() => window.dispatchEvent(new PopStateEvent('popstate')))
expect(screen.getByRole('textbox', { name: /dataset\.newKnowledge\.rootUrl/ })).toHaveValue(
@@ -735,7 +735,7 @@ describe('AddSourcePage', () => {
await user.click(screen.getByRole('button', { name: 'dataset.newKnowledge.connectProvider' }))
await waitFor(() => expect(clientMock.createConnection).toHaveBeenCalledOnce())
- await screen.findByRole('status', { name: 'appApi.loading' })
+ await screen.findByRole('progressbar', { name: 'appApi.loading' })
act(() => window.dispatchEvent(new PopStateEvent('popstate')))
expect(await screen.findByText(/dataset\.newKnowledge\.providerConnected/)).toBeInTheDocument()
expect(screen.queryByText('dataset.newKnowledge.connectionFailed')).not.toBeInTheDocument()
diff --git a/web/features/new-rag/__tests__/document-detail-page.spec.tsx b/web/features/new-rag/__tests__/document-detail-page.spec.tsx
index b76300a2a4e..6c402bdee50 100644
--- a/web/features/new-rag/__tests__/document-detail-page.spec.tsx
+++ b/web/features/new-rag/__tests__/document-detail-page.spec.tsx
@@ -435,7 +435,7 @@ describe('DocumentDetailPage', () => {
render(<DocumentDetailPage documentId="document-1" knowledgeSpaceId="space-1" />)
expect(chunksOptions).not.toHaveBeenCalled()
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('uses source provenance instead of exposing an internal source id', () => {
diff --git a/web/features/new-rag/__tests__/documents-page.spec.tsx b/web/features/new-rag/__tests__/documents-page.spec.tsx
index 91b470ddfb8..0c2c1b5d7eb 100644
--- a/web/features/new-rag/__tests__/documents-page.spec.tsx
+++ b/web/features/new-rag/__tests__/documents-page.spec.tsx
@@ -442,7 +442,7 @@ describe('DocumentsPage', () => {
query: { limit: 100 },
})
expect(sourceOptions?.getNextPageParam({ nextCursor: 'next' })).toBe('next')
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
})
it('restores document search and status filters from the URL', async () => {
@@ -1201,7 +1201,7 @@ describe('DocumentsPage', () => {
expect(documentsQuery.fetchNextPage).toHaveBeenCalledOnce()
expect(screen.queryByText('dataset.newKnowledge.noMatchingDocuments')).not.toBeInTheDocument()
- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(screen.getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(screen.getByText('dataset.newKnowledge.partialDocumentResults')).toBeInTheDocument()
})
@@ -1912,7 +1912,7 @@ describe('DocumentsPage', () => {
rerender(<DocumentsPage knowledgeSpaceId="space-1" />)
const panel = screen.getByRole('dialog', { name: 'dataset.newKnowledge.backgroundTasks' })
- expect(within(panel).getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()
+ expect(within(panel).getByRole('progressbar', { name: 'appApi.loading' })).toBeInTheDocument()
expect(
within(panel).queryByText('dataset.newKnowledge.noBackgroundTasks'),
).not.toBeInTheDocument()
diff --git a/web/features/new-rag/__tests__/knowledge-space-shell.spec.tsx b/web/features/new-rag/__tests__/knowledge-space-shell.spec.tsx
index f484dffd319..8f77d6df5b5 100644
--- a/web/features/new-rag/__tests__/knowledge-space-shell.spec.tsx
+++ b/web/features/new-rag/__tests__/knowledge-space-shell.spec.tsx
@@ -98,7 +98,7 @@ describe('KnowledgeSpaceShell', () => {
)
expect(queryOptionsMock).toHaveBeenCalledWith({ input: { params: { id: 'space-1' } } })
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('renders a refresh-safe header and route navigation when loaded', () => {
diff --git a/web/features/new-rag/__tests__/sources-page.spec.tsx b/web/features/new-rag/__tests__/sources-page.spec.tsx
index c1e9da05078..494a8fbc5df 100644
--- a/web/features/new-rag/__tests__/sources-page.spec.tsx
+++ b/web/features/new-rag/__tests__/sources-page.spec.tsx
@@ -135,7 +135,7 @@ describe('SourcesPage', () => {
state: { data: { pages: [{ items: [source({ status: 'active' })] }] } },
}),
).toBe(false)
- expect(screen.getByRole('status')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
})
it('renders the designed empty state and enters the real add-source route', () => {
@@ -711,7 +711,7 @@ describe('SourcesPage', () => {
expect(sourcesQuery.fetchNextPage).not.toHaveBeenCalled()
expect(screen.getByRole('alert')).toBeInTheDocument()
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument()
expect(screen.queryByText('dataset.newKnowledge.noMatchingSources')).not.toBeInTheDocument()
})
diff --git a/web/features/new-rag/add-source-page.tsx b/web/features/new-rag/add-source-page.tsx
index 43899bb3db6..5a006cd0dbe 100644
--- a/web/features/new-rag/add-source-page.tsx
+++ b/web/features/new-rag/add-source-page.tsx
@@ -14,7 +14,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import { useInfiniteQuery, useQuery, useQueryClient } from '@tanstack/react-query'
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useRouter } from '@/next/navigation'
import { consoleClient, consoleQuery } from '@/service/console'
import { PendingWebsiteSetup, UnavailableConnectedSourceSetup } from './add-source-placeholder'
@@ -954,7 +954,7 @@ export function AddSourcePage({
)
return (
<div className="flex min-h-64 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
@@ -1034,7 +1034,7 @@ export function AddSourcePage({
/>
) : connection?.status === 'active' ? (
<div className="flex min-h-64 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : connection?.status === 'provisioning' ? (
<ProvisioningConnection onReconcile={reconcileConnection} />
diff --git a/web/features/new-rag/document-chunk-tree.tsx b/web/features/new-rag/document-chunk-tree.tsx
index 045234f49ca..ce659cce3a3 100644
--- a/web/features/new-rag/document-chunk-tree.tsx
+++ b/web/features/new-rag/document-chunk-tree.tsx
@@ -3,10 +3,10 @@
import type { DocumentChunkTree } from './document-detail-model'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
+import { SpinnerIcon } from '@langgenius/dify-ui/spinner'
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual'
import { useEffect, useId, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
import { chunkTreeLabel, visibleDocumentChunkNodes } from './document-detail-model'
const VIRTUALIZATION_THRESHOLD = 80
@@ -210,7 +210,7 @@ export function DocumentChunkTreePanel({
)}
{isPending ? (
<div className="flex min-h-40 items-center justify-center" role="status">
- <Loading />
+ <SpinnerIcon />
<span className="sr-only">{tCommon(($) => $.loading)}</span>
</div>
) : error && !isFetchNextPageError && !chunkCount ? (
diff --git a/web/features/new-rag/document-detail-page.tsx b/web/features/new-rag/document-detail-page.tsx
index a4376e8b84b..8e6456b42cf 100644
--- a/web/features/new-rag/document-detail-page.tsx
+++ b/web/features/new-rag/document-detail-page.tsx
@@ -6,7 +6,7 @@ import { useAtomValue } from 'jotai'
import { createParser, useQueryState } from 'nuqs'
import { useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { datasetDefaultPermissionKeysAtom } from '@/context/permission-state'
import useDocumentTitle from '@/hooks/use-document-title'
import { consoleQuery } from '@/service/console'
@@ -164,7 +164,7 @@ export function DocumentDetailPage({
if (documentQuery.isPending)
return (
<div className="flex min-h-80 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
<span className="sr-only">{tCommon(($) => $.loading)}</span>
</div>
)
diff --git a/web/features/new-rag/document-list.tsx b/web/features/new-rag/document-list.tsx
index d5364439657..2a578d5a04f 100644
--- a/web/features/new-rag/document-list.tsx
+++ b/web/features/new-rag/document-list.tsx
@@ -16,7 +16,7 @@ import {
import { toast } from '@langgenius/dify-ui/toast'
import { memo, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
import Link from '@/next/link'
import { sourceName } from './document-model'
@@ -560,7 +560,7 @@ export function DocumentsList({
)}
{completingResults && (
<div className="flex min-h-32 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/features/new-rag/document-revision-content.tsx b/web/features/new-rag/document-revision-content.tsx
index 159643d9b72..20feec08834 100644
--- a/web/features/new-rag/document-revision-content.tsx
+++ b/web/features/new-rag/document-revision-content.tsx
@@ -8,7 +8,7 @@ import { Button } from '@langgenius/dify-ui/button'
import { useInfiniteQuery } from '@tanstack/react-query'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { DocumentChunkDetail } from './document-chunk-detail'
import { DocumentChunkTreePanel } from './document-chunk-tree'
import { buildDocumentChunkTree } from './document-detail-model'
@@ -41,7 +41,7 @@ export function DocumentRevisionContent({
if (effectiveRevision === undefined && revisionHistoryPending)
return (
<div className="flex min-h-80 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)
diff --git a/web/features/new-rag/documents-page.tsx b/web/features/new-rag/documents-page.tsx
index 6cbf5ffc5e0..b31c777593f 100644
--- a/web/features/new-rag/documents-page.tsx
+++ b/web/features/new-rag/documents-page.tsx
@@ -13,7 +13,7 @@ import { useAtomValue, useSetAtom } from 'jotai'
import { debounce, parseAsString, parseAsStringLiteral, useQueryState } from 'nuqs'
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
datasetDefaultPermissionKeysAtom,
refreshWorkspacePermissionKeysAfterMutationDenialAtom,
@@ -2019,7 +2019,7 @@ export function DocumentsPage({ knowledgeSpaceId }: { knowledgeSpaceId: string }
)}
{documentsQuery.isPending && !permissionDenied ? (
<div className="flex min-h-64 flex-1 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : permissionDenied || (documentsQuery.error && !documentsQuery.data) ? (
<div
diff --git a/web/features/new-rag/knowledge-space-shell.tsx b/web/features/new-rag/knowledge-space-shell.tsx
index ae0b66df3d3..7d6b3a20b1b 100644
--- a/web/features/new-rag/knowledge-space-shell.tsx
+++ b/web/features/new-rag/knowledge-space-shell.tsx
@@ -6,7 +6,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import { toast } from '@langgenius/dify-ui/toast'
import { useQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import useDocumentTitle from '@/hooks/use-document-title'
import Link from '@/next/link'
import { usePathname } from '@/next/navigation'
@@ -79,7 +79,7 @@ export function KnowledgeSpaceShell({
<>
{pageTitleElement}
<div className="flex min-h-0 min-w-0 flex-1 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
</>
)
diff --git a/web/features/new-rag/processing-tasks-drawer.tsx b/web/features/new-rag/processing-tasks-drawer.tsx
index d60996d5c75..05c36c1cd58 100644
--- a/web/features/new-rag/processing-tasks-drawer.tsx
+++ b/web/features/new-rag/processing-tasks-drawer.tsx
@@ -20,7 +20,7 @@ import {
import { useMutation } from '@tanstack/react-query'
import { useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
import { consoleQuery } from '@/service/console'
import { taskCanRetry, taskIsActive, taskVersionIsAfter } from './document-model'
@@ -491,7 +491,7 @@ export function ProcessingTasksDrawer({
)}
{taskQueryPending && !orderedTasks.length ? (
<div className="flex min-h-40 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : orderedTasks.length ? (
<ul className="divide-y divide-divider-subtle">
diff --git a/web/features/new-rag/sources-page.tsx b/web/features/new-rag/sources-page.tsx
index d5cb02cadf6..fcb7d9224b9 100644
--- a/web/features/new-rag/sources-page.tsx
+++ b/web/features/new-rag/sources-page.tsx
@@ -28,7 +28,7 @@ import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import { useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import Link from '@/next/link'
import { consoleClient, consoleQuery } from '@/service/console'
@@ -557,7 +557,7 @@ export function SourcesPage({ knowledgeSpaceId }: { knowledgeSpaceId: string })
</header>
{sourcesQuery.isPending ? (
<div className="flex min-h-64 flex-1 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
) : sourcesQuery.error && !sourcesQuery.data ? (
<div className="flex min-h-64 flex-1 flex-col items-center justify-center px-6 text-center">
@@ -724,7 +724,7 @@ export function SourcesPage({ knowledgeSpaceId }: { knowledgeSpaceId: string })
)}
{!filteredSources.length && completingFilteredResults && (
<div className="flex min-h-40 items-center justify-center">
- <Loading />
+ <LoadingPlaceholder />
</div>
)}
</div>
diff --git a/web/features/skills/detail/skill-pdf-preview.tsx b/web/features/skills/detail/skill-pdf-preview.tsx
index d407c23f414..838a404230c 100644
--- a/web/features/skills/detail/skill-pdf-preview.tsx
+++ b/web/features/skills/detail/skill-pdf-preview.tsx
@@ -5,7 +5,7 @@ import {
PdfHighlighter,
PdfLoader,
} from '@/app/components/base/file-uploader/pdf-highlighter-adapter'
-import Loading from '@/app/components/base/loading'
+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
export function SkillPdfPreview({ fileName, url }: { fileName: string; url: string }) {
return (
@@ -14,11 +14,7 @@ export function SkillPdfPreview({ fileName, url }: { fileName: string; url: stri
<PdfLoader
workerSrc="/pdf.worker.min.mjs"
url={url}
- beforeLoad={
- <div className="flex h-full items-center justify-center">
- <Loading type="app" />
- </div>
- }
+ beforeLoad={<LoadingPlaceholder className="h-full" />}
>
{(pdfDocument) => (
<PdfHighlighter