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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(web): move access-point app details to Query (#43728)
yyhc73c98237829
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/access-point/page.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/access-point/page.tsxindex 2ca15f42dfe..cfaeeda89f6 100644--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/access-point/page.tsx+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/access-point/page.tsx@@ -1,4 +1,6 @@+import { Suspense } from 'react'import AccessPoint from '@/app/components/app/access-point'+import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'type AppAccessPointPageProps = {params: Promise<{ appId: string }>@@ -7,5 +9,9 @@ type AppAccessPointPageProps = {export default async function AppAccessPointPage({ params }: AppAccessPointPageProps) {const { appId } = await params- return <AccessPoint appId={appId} />+ return (+ <Suspense fallback={<LoadingPlaceholder className="h-full" />}>+ <AccessPoint appId={appId} />+ </Suspense>+ )}diff --git a/web/app/components/app/access-point/__tests__/built-in-access-points.spec.tsx b/web/app/components/app/access-point/__tests__/built-in-access-points.spec.tsxindex 661b752dc93..004da25a563 100644--- a/web/app/components/app/access-point/__tests__/built-in-access-points.spec.tsx+++ b/web/app/components/app/access-point/__tests__/built-in-access-points.spec.tsx@@ -1,5 +1,11 @@+import type { ReactElement } from 'react'+import type { AppModeEnum } from '@/types/app'import { screen } from '@testing-library/react'-import { render } from '@/test/console/render'+import { consoleQuery } from '@/service/console'+import { createQueryClientWrapper } from '@/test/console/query-client'+import { render as renderWithConsole } from '@/test/console/render'+import { createAppDetailFixture } from '@/test/fixtures/app'+import { createTestQueryClient } from '@/test/query-client'import { BuiltInAccessPoints } from '../built-in-access-points'const mocks = vi.hoisted(() => ({@@ -27,23 +33,20 @@ vi.mock('react-i18next', async () => {return createReactI18nextMock()})-vi.mock('@tanstack/react-query', async (importOriginal) => {- const actual = await importOriginal<typeof import('@tanstack/react-query')>()- return {- ...actual,- useSuspenseQuery: () => ({- data: {- webapp_auth: { enabled: true },- },- }),- }-})--vi.mock('@/app/components/app/store', () => ({- useStore: (selector: (state: Record<string, unknown>) => unknown) =>- selector({ appDetail: mocks.appInfo }),+vi.mock('@/features/system-features/client', () => ({+ systemFeaturesQueryOptions: () => ({ queryKey: ['system-features'] }),}))+function render(ui: ReactElement) {+ const queryClient = createTestQueryClient()+ queryClient.setQueryData(['system-features'], { webapp_auth: { enabled: true } })+ queryClient.setQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ createAppDetailFixture({ ...mocks.appInfo, mode: mocks.appInfo.mode as AppModeEnum }),+ )+ return renderWithConsole(ui, { wrapper: createQueryClientWrapper(queryClient) })+}+vi.mock('@/context/i18n', () => ({useDocLink: () => (path: string) => path,}))diff --git a/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsx b/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsxindex 824e92d1f7c..507012a5029 100644--- a/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsx+++ b/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsx@@ -3,8 +3,11 @@ import { QueryClientProvider } from '@tanstack/react-query'import { screen, waitFor, within } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { toast } from '@/app/notifications'+import { consoleQuery } from '@/service/console'import { render } from '@/test/console/render'+import { createAppDetailFixture, createAppSiteFixture } from '@/test/fixtures/app'import { createTestQueryClient } from '@/test/query-client'+import { AppModeEnum } from '@/types/app'import { EnvironmentServiceApiCard } from '../deployed-environment-access-points/environment-service-api-card'import { EnvironmentWebAppCard } from '../deployed-environment-access-points/environment-web-app-card'@@ -26,32 +29,12 @@ vi.mock('@/features/system-features/client', () => ({}),}))-let mockAppMode = 'workflow'+let mockAppMode: AppModeEnum = AppModeEnum.WORKFLOWvi.mock('@/context/i18n', () => ({useDocLink: () => (path: string) => `https://docs.example.test/en${path}`,}))-vi.mock('@/app/components/app/store', () => ({- useStore: (selector: (state: Record<string, unknown>) => unknown) =>- selector({- appDetail: {- id: 'app-1',- get mode() {- return mockAppMode- },- icon: '🤖',- icon_background: '#FFEAD5',- icon_type: 'emoji',- icon_url: null,- site: {- access_token: 'built-in-code',- app_base_url: 'https://built-in.example.test',- },- },- }),-}))-vi.mock('@/app/components/base/app-icon', () => ({default: () => <div aria-label="app-icon" />,}))@@ -122,6 +105,16 @@ const api = {}function renderCard(ui: ReactElement, queryClient = createTestQueryClient()) {+ queryClient.setQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ createAppDetailFixture({+ mode: mockAppMode,+ site: createAppSiteFixture({+ access_token: 'built-in-code',+ app_base_url: 'https://built-in.example.test',+ }),+ }),+ )queryClient.setQueryData(['system-features'], {webapp_auth: {enabled: true,@@ -148,7 +141,7 @@ afterAll(() => vi.unstubAllGlobals())describe('environment access point cards', () => {beforeEach(() => {vi.clearAllMocks()- mockAppMode = 'workflow'+ mockAppMode = AppModeEnum.WORKFLOWvi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {const request = new Request(input, init)const path = new URL(request.url).pathname@@ -246,7 +239,7 @@ describe('environment access point cards', () => {)it('sends a chatflow app to the chat web app shell', async () => {- mockAppMode = 'advanced-chat'+ mockAppMode = AppModeEnum.ADVANCED_CHATrenderCard(<EnvironmentWebAppCard appId="app-1" environmentId="staging" canManageAccessPoint />)diff --git a/web/app/components/app/access-point/__tests__/index.spec.tsx b/web/app/components/app/access-point/__tests__/index.spec.tsxindex 55424d7bc55..bdc3b28e15b 100644--- a/web/app/components/app/access-point/__tests__/index.spec.tsx+++ b/web/app/components/app/access-point/__tests__/index.spec.tsx@@ -9,11 +9,13 @@ import { consoleQuery } from '@/service/console'import { seedAccountProfileQuery } from '@/test/console/account-profile'import { QueryClientTestProvider } from '@/test/console/query-provider'import { render } from '@/test/console/render'+import { createAppDetailFixture } from '@/test/fixtures/app'import { createTestQueryClient } from '@/test/query-client'+import { AppModeEnum } from '@/types/app'import { AppACLPermission } from '@/utils/permission'import AccessPoint from '..'-let appMode = 'workflow'+let appMode: AppModeEnum = AppModeEnum.WORKFLOWlet appPermissionKeys: string[] = [AppACLPermission.AccessPointView]const accessPointMocks = vi.hoisted(() => ({builtIn: vi.fn(),@@ -31,18 +33,6 @@ vi.mock('react-i18next', async () => {})})-vi.mock('@/app/components/app/store', () => ({- useStore: (selector: (state: Record<string, unknown>) => unknown) =>- selector({- appDetail: {- id: 'app-1',- mode: appMode,- maintainer: 'user-2',- permission_keys: appPermissionKeys,- },- }),-}))-vi.mock('@/context/permission-state', async () => {const { createPermissionStateModuleMock } = await import('@/test/console/state-fixture')return createPermissionStateModuleMock(() => mockConsoleState)@@ -106,6 +96,15 @@ const renderAccessPoint = ({} = {}) => {const queryClient = createTestQueryClient()seedAccountProfileQuery(queryClient, mockConsoleState.userProfile)+ queryClient.setQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ createAppDetailFixture({+ id: 'app-1',+ mode: appMode,+ maintainer: 'user-2',+ permission_keys: appPermissionKeys,+ }),+ )const queryOptions =consoleQuery.enterprise.appDeploy.deploymentService.listAppEnvironments.queryOptions({input: {@@ -134,7 +133,7 @@ const renderAccessPoint = ({describe('AccessPoint', () => {beforeEach(() => {vi.clearAllMocks()- appMode = 'workflow'+ appMode = AppModeEnum.WORKFLOWappPermissionKeys = [AppACLPermission.AccessPointView]})@@ -244,7 +243,7 @@ describe('AccessPoint', () => {})it('hides environment tabs for app types without multi-environment support', () => {- appMode = 'chat'+ appMode = AppModeEnum.CHATrenderAccessPoint()diff --git a/web/app/components/app/access-point/__tests__/service-api-card.spec.tsx b/web/app/components/app/access-point/__tests__/service-api-card.spec.tsxindex 69a7acea2a3..d834c976ef6 100644--- a/web/app/components/app/access-point/__tests__/service-api-card.spec.tsx+++ b/web/app/components/app/access-point/__tests__/service-api-card.spec.tsx@@ -1,9 +1,9 @@import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gen'-import { QueryClientProvider } from '@tanstack/react-query'+import { QueryClientProvider, useSuspenseQuery } from '@tanstack/react-query'import { screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'-import { useStore as useAppStore } from '@/app/components/app/store'import { toast } from '@/app/notifications'+import { consoleQuery } from '@/service/console'import { render } from '@/test/console/render'import { createAppDetailFixture } from '@/test/fixtures/app'import { createTestQueryClient } from '@/test/query-client'@@ -11,6 +11,7 @@ import { AppModeEnum } from '@/types/app'import { ServiceApiAccessPointCard } from '../built-in-access-points/service-api-card'const mocks = vi.hoisted(() => ({+ appInfo: null as AppDetailWithSite | null,apiSecretKeyButtonProps: vi.fn(),apiEnable: vi.fn(),}))@@ -22,22 +23,19 @@ vi.mock('@/app/notifications', () => ({},}))-vi.mock('@/service/console', () => ({- consoleQuery: {- apps: {- byAppId: {- apiEnable: {- post: {- mutationOptions: (options = {}) => ({- mutationFn: mocks.apiEnable,- ...options,- }),- },- },- },+vi.mock('@/service/base', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/service/base')>()+ return {+ ...actual,+ request: async (url: string, _init: RequestInit, options: { request: Request }) => {+ if (options.request.method === 'GET') return Response.json(mocks.appInfo)+ const body = await options.request.json()+ const updatedApp = await mocks.apiEnable({ params: { app_id: 'app-1' }, body })+ mocks.appInfo = { ...mocks.appInfo, ...updatedApp }+ return Response.json(mocks.appInfo)},- },-}))+ }+})vi.mock('@/context/i18n', () => ({useDocLink: () => (path: string) => `https://docs.example.test/en${path}`,@@ -73,24 +71,30 @@ function renderCard(canManage = true,overrides: Partial<AppDetailWithSite> = {},) {- useAppStore.setState({ appDetail: createAppInfo(mode, overrides) })+ mocks.appInfo = createAppInfo(mode, overrides)const queryClient = createTestQueryClient()+ queryClient.setQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ createAppInfo(mode, overrides),+ )return render(<QueryClientProvider client={queryClient}>- <StoreConnectedServiceApiCard availability={availability} canManage={canManage} />+ <QueryConnectedServiceApiCard availability={availability} canManage={canManage} /></QueryClientProvider>,)}-function StoreConnectedServiceApiCard({+function QueryConnectedServiceApiCard({availability,canManage,}: {availability: 'available' | 'loading' | 'unavailable'canManage: boolean}) {- const appInfo = useAppStore((state) => state.appDetail)+ const { data: appInfo } = useSuspenseQuery(+ consoleQuery.apps.byAppId.get.queryOptions({ input: { params: { app_id: 'app-1' } } }),+ )if (!appInfo) return nullreturn (@@ -116,9 +120,7 @@ function createDeferredPromise<T>() {describe('ServiceApiAccessPointCard', () => {beforeEach(() => {vi.clearAllMocks()- mocks.apiEnable.mockResolvedValue({- enable_api: true,- })+ mocks.apiEnable.mockResolvedValue(createAppDetailFixture({ enable_api: true }))})it.each([@@ -209,14 +211,14 @@ describe('ServiceApiAccessPointCard', () => {it('keeps successful status changes silent', async () => {const user = userEvent.setup()- mocks.apiEnable.mockResolvedValueOnce({ enable_api: false })+ mocks.apiEnable.mockResolvedValueOnce(createAppDetailFixture({ enable_api: false }))renderCard(AppModeEnum.WORKFLOW)const accessSwitch = screen.getByRole('switch')await user.click(accessSwitch)await waitFor(() => {- expect(useAppStore.getState().appDetail?.enable_api).toBe(false)+ expect(screen.getByRole('switch')).not.toBeChecked()})expect(accessSwitch).toHaveAttribute('aria-checked', 'false')expect(toast.success).not.toHaveBeenCalled()diff --git a/web/app/components/app/access-point/__tests__/use-access-point-actions.spec.ts b/web/app/components/app/access-point/__tests__/use-access-point-actions.spec.tsindex 67091c8c8c0..82dd1c690a6 100644--- a/web/app/components/app/access-point/__tests__/use-access-point-actions.spec.ts+++ b/web/app/components/app/access-point/__tests__/use-access-point-actions.spec.ts@@ -2,7 +2,9 @@ import type {AppSiteResponse,AppSiteUpdatePayload,} from '@dify/contracts/api/console/apps/types.gen'+import { useQuery } from '@tanstack/react-query'import { act, renderHook, waitFor } from '@testing-library/react'+import { consoleQuery } from '@/service/console'import { createQueryClientWrapper } from '@/test/console/query-client'import { createAppDetailFixture } from '@/test/fixtures/app'import { createTestQueryClient } from '@/test/query-client'@@ -10,38 +12,29 @@ import { useAccessPointActions } from '../shared/use-access-point-actions'const mocks = vi.hoisted(() => ({fetchAppDetail: vi.fn(),- setAppDetail: vi.fn(),toast: vi.fn(),updateAppSiteConfig: vi.fn(),}))vi.mock('@/app/notifications', () => ({ toast: mocks.toast }))-vi.mock('@/app/components/app/store', () => ({- useStore: (selector: (state: { setAppDetail: typeof mocks.setAppDetail }) => unknown) =>- selector({ setAppDetail: mocks.setAppDetail }),-}))--vi.mock('@/service/console', () => ({- consoleClient: {- apps: { byAppId: { get: mocks.fetchAppDetail, site: { post: mocks.updateAppSiteConfig } } },- },- consoleQuery: {- apps: {- get: { key: () => ['apps'] },- recent: { get: { key: () => ['apps', 'recent'] } },- starred: { get: { key: () => ['apps', 'starred'] } },- byAppId: {- get: {- queryKey: ({ input }: { input: { params: { app_id: string } } }) => [- 'app-detail',- input.params.app_id,- ],- },- },+vi.mock('@/service/base', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/service/base')>()+ return {+ ...actual,+ request: async (url: string, _init: RequestInit, options: { request: Request }) => {+ const appId = /\/apps\/([^/]+)/.exec(url)?.[1]+ if (options.request.method === 'GET')+ return Response.json(await mocks.fetchAppDetail({ params: { app_id: appId } }))+ return Response.json(+ await mocks.updateAppSiteConfig({+ params: { app_id: appId },+ body: await options.request.json(),+ }),+ )},- },-}))+ }+})const siteConfig = {chat_color_theme: '#000000',@@ -62,9 +55,19 @@ const siteConfig = {function renderActions(appId = 'app-1', canManageAccessPoint = true) {const queryClient = createTestQueryClient()- const rendered = renderHook(() => useAccessPointActions(appId, canManageAccessPoint), {- wrapper: createQueryClientWrapper(queryClient),- })+ queryClient.setQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: appId } } }),+ createAppDetailFixture({ id: appId }),+ )+ const rendered = renderHook(+ () => {+ useQuery(consoleQuery.apps.byAppId.get.queryOptions({ input: { params: { app_id: appId } } }))+ return useAccessPointActions(appId, canManageAccessPoint)+ },+ {+ wrapper: createQueryClientWrapper(queryClient),+ },+ )return { ...rendered, queryClient }}@@ -84,25 +87,25 @@ describe('useAccessPointActions', () => {} satisfies AppSiteResponse)})- it('refreshes after a successful access point result', async () => {- const { result } = renderActions()+ it('refreshes access metadata through the app detail query', async () => {+ const { result, queryClient } = renderActions()- act(() => result.current.handleResult(null))+ await act(async () => result.current.refreshAppDetail())await waitFor(() => {expect(mocks.fetchAppDetail).toHaveBeenCalledWith({ params: { app_id: 'app-1' } })- expect(mocks.setAppDetail).toHaveBeenCalledWith(createAppDetailFixture())- })- expect(mocks.toast).toHaveBeenCalledWith('common.actionMsg.modifiedSuccessfully', {- type: 'success',+ expect(+ queryClient.getQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ ),+ ).toEqual(createAppDetailFixture())})})- it('reports a failed result without refreshing stale state', () => {+ it('reports a failed save without invalidating app details', async () => {+ mocks.updateAppSiteConfig.mockRejectedValueOnce(new Error('request failed'))const { result } = renderActions()-- act(() => result.current.handleResult(new Error('request failed')))-+ await act(async () => result.current.saveSiteConfig(siteConfig))expect(mocks.fetchAppDetail).not.toHaveBeenCalled()expect(mocks.toast).toHaveBeenCalledWith('common.actionMsg.modifiedUnsuccessfully', {type: 'error',@@ -121,11 +124,21 @@ describe('useAccessPointActions', () => {params: { app_id: 'app-1' },body: siteConfig,})- expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['app-detail', 'app-1'] })- expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['apps'] })- expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['apps', 'starred'] })- expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['apps', 'recent'] })- await waitFor(() => expect(mocks.setAppDetail).toHaveBeenCalledWith(createAppDetailFixture()))+ expect(invalidateQueries).toHaveBeenCalledWith({+ queryKey: consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ })+ expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: consoleQuery.apps.get.key() })+ expect(invalidateQueries).toHaveBeenCalledWith({+ queryKey: consoleQuery.apps.starred.get.key(),+ })+ expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: consoleQuery.apps.recent.get.key() })+ await waitFor(() =>+ expect(+ queryClient.getQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ ),+ ).toEqual(createAppDetailFixture()),+ )})it('keeps site configuration behind Access Point management permission', async () => {diff --git a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsxindex df14cae72d6..51bbe652e25 100644--- a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx+++ b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx@@ -1,13 +1,13 @@-import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gen'+import type { AppDetailWithSite, AppSiteResponse } from '@dify/contracts/api/console/apps/types.gen'import type { PublishedWorkflow } from '../shared/utils'import type { InputVar, Node } from '@/app/components/workflow/types'-import { QueryClientProvider } from '@tanstack/react-query'-import { screen, waitFor, within } from '@testing-library/react'+import { QueryClientProvider, useSuspenseQuery } from '@tanstack/react-query'+import { act, screen, waitFor, within } from '@testing-library/react'import userEvent from '@testing-library/user-event'-import { useStore as useAppStore } from '@/app/components/app/store'import { BlockEnum, InputVarType } from '@/app/components/workflow/types'import { toast } from '@/app/notifications'import { AccessMode } from '@/models/access-control'+import { consoleQuery } from '@/service/console'import { seedAccountProfileQuery } from '@/test/console/account-profile'import { render } from '@/test/console/render'import { createAppDetailFixture, createAppSiteFixture } from '@/test/fixtures/app'@@ -17,6 +17,8 @@ import { basePath } from '@/utils/var'import { WebAppAccessPointCard } from '../built-in-access-points/web-app-card'const mocks = vi.hoisted(() => ({+ appInfo: null as AppDetailWithSite | null,+ getAppDetail: vi.fn<() => Promise<AppDetailWithSite | null>>(),getUserCanAccess: vi.fn<() => Promise<{ result: boolean }>>(),siteEnable: vi.fn(),resetSiteAccessToken: vi.fn().mockResolvedValue({}),@@ -29,34 +31,26 @@ vi.mock('@/app/notifications', () => ({},}))-vi.mock('@/service/console', async (importOriginal) => {- const actual = await importOriginal<typeof import('@/service/console')>()+vi.mock('@/service/base', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/service/base')>()return {...actual,- consoleQuery: {- account: actual.consoleQuery.account,- apps: {- byAppId: {- siteEnable: {- post: {- mutationOptions: (options = {}) => ({- mutationFn: mocks.siteEnable,- ...options,- }),- },- },- site: {- accessTokenReset: {- post: {- mutationOptions: (options = {}) => ({- mutationFn: mocks.resetSiteAccessToken,- ...options,- }),- },- },- },- },- },+ request: async (url: string, _init: RequestInit, options: { request: Request }) => {+ if (options.request.method === 'GET') return Response.json(await mocks.getAppDetail())+ if (url.endsWith('/site/access-token-reset')) {+ const site = await mocks.resetSiteAccessToken({ params: { app_id: 'app-1' } })+ if (mocks.appInfo?.site) {+ mocks.appInfo = {+ ...mocks.appInfo,+ site: { ...mocks.appInfo.site, code: site.code, access_token: site.code },+ }+ }+ return Response.json(site)+ }+ const body = await options.request.json()+ const updatedApp = await mocks.siteEnable({ params: { app_id: 'app-1' }, body })+ mocks.appInfo = { ...mocks.appInfo, ...updatedApp }+ return Response.json(mocks.appInfo)},}})@@ -138,18 +132,20 @@ function renderCard(showAccessControl?: boolean} = {},) {- useAppStore.setState({- appDetail: { ...createAppInfo(mode), ...appOverrides, access_mode: accessMode },- })+ mocks.appInfo = { ...createAppInfo(mode), ...appOverrides, access_mode: accessMode }const queryClient = createTestQueryClient()seedAccountProfileQuery(queryClient)+ queryClient.setQueryData(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: { app_id: 'app-1' } } }),+ { ...createAppInfo(mode), ...appOverrides, access_mode: accessMode },+ )queryClient.setQueryData(['system-features'], {webapp_auth: { enabled: showAccessControl },})return render(<QueryClientProvider client={queryClient}>- <StoreConnectedWebAppCard+ <QueryConnectedWebAppCardavailability={availability}canManageAccessPoint={canManageAccessPoint}onRefreshApp={onRefreshApp}@@ -160,7 +156,7 @@ function renderCard()}-function StoreConnectedWebAppCard({+function QueryConnectedWebAppCard({availability,canManageAccessPoint,onRefreshApp,@@ -173,7 +169,9 @@ function StoreConnectedWebAppCard({showAccessControl: booleanworkflow?: PublishedWorkflow}) {- const appInfo = useAppStore((state) => state.appDetail)+ const { data: appInfo } = useSuspenseQuery(+ consoleQuery.apps.byAppId.get.queryOptions({ input: { params: { app_id: 'app-1' } } }),+ )if (!appInfo) return nullreturn (@@ -245,11 +243,19 @@ const workflowWithHiddenInput: NonNullable<PublishedWorkflow> = {describe('WebAppAccessPointCard', () => {beforeEach(() => {vi.clearAllMocks()+ mocks.getAppDetail.mockReset().mockImplementation(async () => mocks.appInfo)mocks.getUserCanAccess.mockResolvedValue({ result: true })- mocks.siteEnable.mockResolvedValue({- enable_site: true,- })- mocks.resetSiteAccessToken.mockResolvedValue({})+ mocks.siteEnable.mockResolvedValue(createAppDetailFixture({ enable_site: true }))+ mocks.resetSiteAccessToken.mockResolvedValue({+ app_id: 'app-1',+ code: 'new-site-code',+ customize_token_strategy: 'not_allow',+ default_language: 'en-US',+ prompt_public: false,+ show_workflow_steps: false,+ title: 'App',+ use_icon_as_answer_icon: false,+ } satisfies AppSiteResponse)})afterEach(() => {@@ -423,20 +429,31 @@ describe('WebAppAccessPointCard', () => {expect(mocks.siteEnable).not.toHaveBeenCalled()})- it('resets the site access token through the generated contract', async () => {+ it('updates the regenerated link before the detail refresh completes', async () => {const user = userEvent.setup()- const onRefreshApp = vi.fn().mockResolvedValue(undefined)- renderCard(AppModeEnum.CHAT, 'available', undefined, { onRefreshApp })+ const refresh = createDeferredPromise<AppDetailWithSite | null>()+ mocks.getAppDetail.mockReturnValueOnce(refresh.promise)+ renderCard(AppModeEnum.CHAT)await user.click(screen.getByRole('button', { name: /overview\.appInfo\.regenerate/ }))await user.click(screen.getByRole('button', { name: /operation\.confirm/ }))- await waitFor(() => {+ try {+ await waitFor(() => {+ expect(mocks.getAppDetail).toHaveBeenCalledOnce()+ expect(screen.queryByRole('button', { name: /operation\.confirm/ })).not.toBeInTheDocument()+ })expect(mocks.resetSiteAccessToken.mock.calls[0]?.[0]).toEqual({params: { app_id: 'app-1' },})- expect(onRefreshApp).toHaveBeenCalledTimes(1)- })+ expect(screen.getByRole('button', { name: /overview\.appInfo\.regenerate/ })).toBeEnabled()+ expect(screen.getByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'href',+ `https://site.example.test${basePath}/chat/new-site-code`,+ )+ } finally {+ await act(async () => refresh.resolve(mocks.appInfo))+ }})it('keeps generated mutation failures inside the card owner', async () => {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.tsxindex a9ef011645c..2d9bf69bbfe 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@@ -5,11 +5,11 @@ import { Button, buttonVariants } from '@langgenius/dify-ui/button'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 { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'import { useDocLink } from '@/context/i18n'import { systemFeaturesQueryOptions } from '@/features/system-features/client'import Link from '@/next/link'+import { consoleQuery } from '@/service/console'import { useAppWorkflow } from '@/service/use-workflow'import { useAccessPointActions } from '../shared/use-access-point-actions'import { getPublishedWorkflowState, isAdvancedApp } from '../shared/utils'@@ -35,7 +35,9 @@ export function BuiltInAccessPoints({}: BuiltInAccessPointsProps) {const { t } = useTranslation(['common', 'deployments'])const docLink = useDocLink()- const appInfo = useAppStore((state) => state.appDetail)+ const { data: appInfo } = useSuspenseQuery(+ consoleQuery.apps.byAppId.get.queryOptions({ input: { params: { app_id: appId } } }),+ )const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())const shouldFetchWorkflow = Boolean(appInfo && isAdvancedApp(appInfo))const {diff --git a/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx b/web/app/components/app/access-point/built-in-access-points/service-api-card.tsxindex c6e5f06b658..3f9d4742f29 100644--- a/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx+++ b/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx@@ -4,7 +4,6 @@ import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gimport type { AccessPointAvailability } from '@/app/components/base/access-point/status'import { useMutation } from '@tanstack/react-query'import { useTranslation } from 'react-i18next'-import { useStore as useAppStore } from '@/app/components/app/store'import { getAccessPointStatus } from '@/app/components/base/access-point/status'import { toast } from '@/app/notifications'import { consoleQuery } from '@/service/console'@@ -25,22 +24,11 @@ export function ServiceApiAccessPointCard({highlighted,}: ServiceApiAccessPointCardProps) {const { t } = useTranslation(['common'])- const setAppDetail = useAppStore((state) => state.setAppDetail)const toggleApiMutation = useMutation(consoleQuery.apps.byAppId.apiEnable.post.mutationOptions({scope: {id: `app-service-api-toggle:${appInfo.id}`,},- onSuccess: (updatedApp) => {- const currentAppDetail = useAppStore.getState().appDetail- if (!currentAppDetail || currentAppDetail.id !== appInfo.id) return-- setAppDetail({- ...currentAppDetail,- enable_api: updatedApp.enable_api,- updated_at: updatedApp.updated_at ?? currentAppDetail.updated_at,- })- },onError: () => {toast.error(t(($) => $['actionMsg.modifiedUnsuccessfully'], { ns: 'common' }))},diff --git a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsxindex dd1722c6c51..6ef9b1b6fba 100644--- a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx+++ b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx@@ -26,7 +26,6 @@ import { CustomizeDialog } from '@/app/components/app/overview/customize'import { EmbeddedDialogContent } from '@/app/components/app/overview/embedded'import SettingsModal from '@/app/components/app/overview/settings'import { WorkflowLaunchDialog } from '@/app/components/app/overview/workflow-launch-dialog'-import { useStore as useAppStore } from '@/app/components/app/store'import { AccessPointCard } from '@/app/components/base/access-point/card'import { getAccessPointStatus } from '@/app/components/base/access-point/status'import { AccessPointUrl } from '@/app/components/base/access-point/url'@@ -91,7 +90,6 @@ export function WebAppAccessPointCard({'deployments','navigation',])- const setAppDetail = useAppStore((state) => state.setAppDetail)const [showSettings, setShowSettings] = useState(false)const [showAccess, setShowAccess] = useState(false)const [showRegenerate, setShowRegenerate] = useState(false)@@ -101,16 +99,6 @@ export function WebAppAccessPointCard({scope: {id: `app-web-app-toggle:${appInfo.id}`,},- onSuccess: (updatedApp) => {- const currentAppDetail = useAppStore.getState().appDetail- if (!currentAppDetail || currentAppDetail.id !== appInfo.id) return-- setAppDetail({- ...currentAppDetail,- enable_site: updatedApp.enable_site,- updated_at: updatedApp.updated_at ?? currentAppDetail.updated_at,- })- },onError: () => {toast.error(t(($) => $['actionMsg.modifiedUnsuccessfully'], { ns: 'common' }))},@@ -118,10 +106,7 @@ export function WebAppAccessPointCard({)const resetSiteAccessToken = useMutation(consoleQuery.apps.byAppId.site.accessTokenReset.post.mutationOptions({- onSuccess: async () => {- await onRefreshApp()- setShowRegenerate(false)- },+ onSuccess: () => setShowRegenerate(false),onError: () => {toast.error(t(($) => $['actionMsg.generatedUnsuccessfully'], { ns: 'common' }))setShowRegenerate(false)diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsxindex 88c439e91f4..40b653e80f1 100644--- a/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx@@ -1,8 +1,7 @@'use client'-import { useMutation, useQuery } from '@tanstack/react-query'+import { useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query'import { useTranslation } from 'react-i18next'-import { useStore as useAppStore } from '@/app/components/app/store'import { toast } from '@/app/notifications'import { consoleQuery } from '@/service/console'import { ServiceApiCardView } from '../shared/service-api-card-view'@@ -21,7 +20,12 @@ export function EnvironmentServiceApiCard({highlighted,}: EnvironmentServiceApiCardProps) {const { t } = useTranslation(['common'])- const appMode = useAppStore((state) => state.appDetail?.mode)+ const { data: appMode } = useSuspenseQuery(+ consoleQuery.apps.byAppId.get.queryOptions({+ input: { params: { app_id: appId } },+ select: (appDetail) => appDetail.mode,+ }),+ )const params = {app_id: appId,environment_id: environmentId,diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsxindex f39bad4d4f9..a036550bf13 100644--- a/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx@@ -15,7 +15,6 @@ import { useState } from 'react'import { useTranslation } from 'react-i18next'import { CustomizeDialog } from '@/app/components/app/overview/customize'import SettingsModal from '@/app/components/app/overview/settings'-import { useStore as useAppStore } from '@/app/components/app/store'import { AccessPointCard } from '@/app/components/base/access-point/card'import { AccessPointUrl } from '@/app/components/base/access-point/url'import AppIcon from '@/app/components/base/app-icon'@@ -61,7 +60,9 @@ export function EnvironmentWebAppCard({'navigation',])const queryClient = useQueryClient()- const appInfo = useAppStore((state) => state.appDetail)+ const { data: appInfo } = useSuspenseQuery(+ consoleQuery.apps.byAppId.get.queryOptions({ input: { params: { app_id: appId } } }),+ )const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())const actions = useAccessPointActions(appId, canManageAccessPoint)const [showSettings, setShowSettings] = useState(false)diff --git a/web/app/components/app/access-point/index.tsx b/web/app/components/app/access-point/index.tsxindex d068ac999fe..5d4465e0ce6 100644--- a/web/app/components/app/access-point/index.tsx+++ b/web/app/components/app/access-point/index.tsx@@ -8,14 +8,14 @@ import {ScrollAreaViewport,} from '@langgenius/dify-ui/scroll-area'import { Tabs, TabsList, TabsTab } from '@langgenius/dify-ui/tabs'-import { useSuspenseQuery } from '@tanstack/react-query'+import { useSuspenseQueries } from '@tanstack/react-query'import { useAtomValue } from 'jotai'import { parseAsString, parseAsStringLiteral, useQueryStates } from 'nuqs'import { useTranslation } from 'react-i18next'import { ACCESS_POINT_ORDER } from '@/app/components/app/deploy/utils/access-point'-import { useStore as useAppStore } from '@/app/components/app/store'import { workspacePermissionKeysAtom } from '@/context/permission-state'import { userProfileQueryOptions } from '@/features/account-profile/client'+import { consoleQuery } from '@/service/console'import { AppModeEnum } from '@/types/app'import { getAppACLCapabilities } from '@/utils/permission'import { BuiltInAccessPoints } from './built-in-access-points'@@ -149,14 +149,15 @@ function AccessPointContent({}export default function AccessPoint({ appId }: AccessPointProps) {- const appDetail = useAppStore((state) => state.appDetail)- const { data: currentUserId } = useSuspenseQuery({- ...userProfileQueryOptions(),- select: (data) => data.profile.id,+ const [{ data: appDetail }, { data: userProfile }] = useSuspenseQueries({+ queries: [+ consoleQuery.apps.byAppId.get.queryOptions({ input: { params: { app_id: appId } } }),+ userProfileQueryOptions(),+ ],})const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)const capabilities = getAppACLCapabilities(appDetail?.permission_keys, {- currentUserId,+ currentUserId: userProfile.profile.id,resourceMaintainer: appDetail?.maintainer,workspacePermissionKeys,})diff --git a/web/app/components/app/access-point/shared/use-access-point-actions.ts b/web/app/components/app/access-point/shared/use-access-point-actions.tsindex 61419b8bb35..83f6e8b7531 100644--- a/web/app/components/app/access-point/shared/use-access-point-actions.ts+++ b/web/app/components/app/access-point/shared/use-access-point-actions.ts@@ -1,69 +1,51 @@'use client'import type { AppSiteUpdatePayload } from '@dify/contracts/api/console/apps/types.gen'-import type { I18nKeysByPrefix } from '@/types/i18n'-import { useQueryClient } from '@tanstack/react-query'+import { useMutation, useQueryClient } from '@tanstack/react-query'import { useCallback } from 'react'import { useTranslation } from 'react-i18next'-import { useStore as useAppStore } from '@/app/components/app/store'import { toast } from '@/app/notifications'-import { consoleClient, consoleQuery } from '@/service/console'+import { consoleQuery } from '@/service/console'import { asyncRunSafe } from '@/utils'export function useAccessPointActions(appId: string, canManageAccessPoint: boolean) {const { t } = useTranslation(['common'])const queryClient = useQueryClient()- const setAppDetail = useAppStore((state) => state.setAppDetail)- const refreshAppDetail = useCallback(async () => {- try {- const appDetail = await consoleClient.apps.byAppId.get({ params: { app_id: appId } })- setAppDetail(appDetail)- } catch (error) {- console.error('Failed to refresh app detail:', error)- }- }, [appId, setAppDetail])-- const handleResult = useCallback(- (error: Error | null, message?: I18nKeysByPrefix<'common', 'actionMsg.'>) => {- const type = error ? 'error' : 'success'- const resolvedMessage = message ?? (error ? 'modifiedUnsuccessfully' : 'modifiedSuccessfully')-- if (!error) {- void refreshAppDetail()- }-- toast(t(($) => $[`actionMsg.${resolvedMessage}`], { ns: 'common' }) as string, {- type,- })- },- [refreshAppDetail, t],+ const { mutateAsync: updateSiteConfig } = useMutation(+ consoleQuery.apps.byAppId.site.post.mutationOptions(),)+ const refreshAppDetail = useCallback(+ () =>+ queryClient.invalidateQueries({+ queryKey: consoleQuery.apps.byAppId.get.queryKey({+ input: { params: { app_id: appId } },+ }),+ }),+ [appId, queryClient],+ )+const saveSiteConfig = useCallback(async (params: AppSiteUpdatePayload) => {if (!canManageAccessPoint) returnconst [error] = await asyncRunSafe(- consoleClient.apps.byAppId.site.post({+ updateSiteConfig({params: { app_id: appId },body: params,}),)- if (!error) {- void queryClient.invalidateQueries({- queryKey: consoleQuery.apps.byAppId.get.queryKey({- input: { params: { app_id: appId } },- }),- })- void queryClient.invalidateQueries({ queryKey: consoleQuery.apps.get.key() })- void queryClient.invalidateQueries({ queryKey: consoleQuery.apps.starred.get.key() })- void queryClient.invalidateQueries({ queryKey: consoleQuery.apps.recent.get.key() })- }- handleResult(error)+ toast(+ t(($) => $[`actionMsg.${error ? 'modifiedUnsuccessfully' : 'modifiedSuccessfully'}`], {+ ns: 'common',+ }) as string,+ {+ type: error ? 'error' : 'success',+ },+ )},- [appId, canManageAccessPoint, handleResult, queryClient],+ [appId, canManageAccessPoint, t, updateSiteConfig],)return {- handleResult,refreshAppDetail,saveSiteConfig,}diff --git a/web/i18n/locales/ar-TN/common.json b/web/i18n/locales/ar-TN/common.jsonindex de7a7c5fc47..b029c700121 100644--- a/web/i18n/locales/ar-TN/common.json+++ b/web/i18n/locales/ar-TN/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "فشل الإنشاء","actionMsg.modifiedSuccessfully": "تم التعديل بنجاح","actionMsg.modifiedUnsuccessfully": "فشل التعديل",- "actionMsg.noModification": "لا توجد تعديلات في الوقت الحالي.","actionMsg.payCancelled": "تم إلغاء الدفع","actionMsg.paySucceeded": "نجح الدفع","agentStrategyPage.description": "حدّد كيف يفكر AI Agent ويتخذ القرارات — بما في ذلك كيفية اختيار الأدوات ومعالجة النتائج وحل المشكلات ذاتيًا.",diff --git a/web/i18n/locales/az-AZ/common.json b/web/i18n/locales/az-AZ/common.jsonindex c8347f63a8e..4db4a173bf8 100644--- a/web/i18n/locales/az-AZ/common.json+++ b/web/i18n/locales/az-AZ/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Yaratma alınmadı","actionMsg.modifiedSuccessfully": "Uğurla dəyişdirildi","actionMsg.modifiedUnsuccessfully": "Dəyişdirmə alınmadı",- "actionMsg.noModification": "Hazırda dəyişiklik yoxdur.","actionMsg.payCancelled": "Ödəniş ləğv edildi","actionMsg.paySucceeded": "Ödəniş uğurla tamamlandı","agentStrategyPage.description": "Süni intellekt agentinizin necə mühakimə yürüdüb qərar verdiyini, o cümlədən alətləri necə seçdiyini, nəticələri necə emal etdiyini və problemləri müstəqil şəkildə necə həll etdiyini müəyyənləşdirin.",diff --git a/web/i18n/locales/de-DE/common.json b/web/i18n/locales/de-DE/common.jsonindex 5e33cbc4060..6a71bd0b72b 100644--- a/web/i18n/locales/de-DE/common.json+++ b/web/i18n/locales/de-DE/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generierung nicht erfolgreich","actionMsg.modifiedSuccessfully": "Erfolgreich geändert","actionMsg.modifiedUnsuccessfully": "Änderung nicht erfolgreich",- "actionMsg.noModification": "Im Moment keine Änderungen.","actionMsg.payCancelled": "Zahlung abgebrochen","actionMsg.paySucceeded": "Zahlung erfolgreich","agentStrategyPage.description": "Lege fest, wie dein AI Agent denkt und Entscheidungen trifft — einschließlich Tool-Auswahl, Ergebnisverarbeitung und autonomer Problemlösung.",diff --git a/web/i18n/locales/en-US/common.json b/web/i18n/locales/en-US/common.jsonindex 1c45250e6e6..0795dd48a11 100644--- a/web/i18n/locales/en-US/common.json+++ b/web/i18n/locales/en-US/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generated unsuccessfully","actionMsg.modifiedSuccessfully": "Modified successfully","actionMsg.modifiedUnsuccessfully": "Modified unsuccessfully",- "actionMsg.noModification": "No modifications at the moment.","actionMsg.payCancelled": "Payment cancelled","actionMsg.paySucceeded": "Payment succeeded","agentStrategyPage.description": "Define how your AI agent reasons and makes decisions — including how it selects tools, handles results, and solves problems autonomously.",diff --git a/web/i18n/locales/es-ES/common.json b/web/i18n/locales/es-ES/common.jsonindex 605ad112a93..d232584db57 100644--- a/web/i18n/locales/es-ES/common.json+++ b/web/i18n/locales/es-ES/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generación no exitosa","actionMsg.modifiedSuccessfully": "Modificado exitosamente","actionMsg.modifiedUnsuccessfully": "Modificación no exitosa",- "actionMsg.noModification": "No hay modificaciones en este momento.","actionMsg.payCancelled": "Pago cancelado","actionMsg.paySucceeded": "Pago exitoso","agentStrategyPage.description": "Define cómo razona y toma decisiones tu AI Agent, incluido cómo selecciona herramientas, procesa resultados y resuelve problemas de forma autónoma.",diff --git a/web/i18n/locales/fa-IR/common.json b/web/i18n/locales/fa-IR/common.jsonindex be490daf5e1..e7b3de70e4b 100644--- a/web/i18n/locales/fa-IR/common.json+++ b/web/i18n/locales/fa-IR/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "تولید ناموفق بود","actionMsg.modifiedSuccessfully": "با موفقیت تغییر یافت","actionMsg.modifiedUnsuccessfully": "تغییر ناموفق بود",- "actionMsg.noModification": "در حال حاضر تغییری وجود ندارد.","actionMsg.payCancelled": "پرداخت لغو شد","actionMsg.paySucceeded": "پرداخت موفق","agentStrategyPage.description": "مشخص کنید AI Agent شما چگونه استدلال و تصمیمگیری میکند — از جمله نحوه انتخاب ابزارها، پردازش نتایج و حل خودکار مسائل.",diff --git a/web/i18n/locales/fr-FR/common.json b/web/i18n/locales/fr-FR/common.jsonindex 7dad3cffd06..f831493bf33 100644--- a/web/i18n/locales/fr-FR/common.json+++ b/web/i18n/locales/fr-FR/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Généré sans succès","actionMsg.modifiedSuccessfully": "Modifié avec succès","actionMsg.modifiedUnsuccessfully": "Modifié sans succès",- "actionMsg.noModification": "Aucune modification pour le moment.","actionMsg.payCancelled": "Paiement annulé","actionMsg.paySucceeded": "Paiement réussi","agentStrategyPage.description": "Définissez comment votre AI Agent raisonne et prend des décisions — y compris la sélection des outils, le traitement des résultats et la résolution autonome des problèmes.",diff --git a/web/i18n/locales/hi-IN/common.json b/web/i18n/locales/hi-IN/common.jsonindex b8382ab0f7b..3e1b74ac542 100644--- a/web/i18n/locales/hi-IN/common.json+++ b/web/i18n/locales/hi-IN/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "उत्पन्न असफल रहा","actionMsg.modifiedSuccessfully": "सफलतापूर्वक संशोधित किया गया","actionMsg.modifiedUnsuccessfully": "संशोधन असफल रहा",- "actionMsg.noModification": "इस समय कोई संशोधन नहीं।","actionMsg.payCancelled": "भुगतान रद्द कर दिया गया","actionMsg.paySucceeded": "भुगतान सफल रहा","agentStrategyPage.description": "परिभाषित करें कि आपका AI Agent कैसे सोचता और निर्णय लेता है — वह टूल कैसे चुनता है, परिणाम कैसे संभालता है और समस्याएँ स्वायत्त रूप से कैसे हल करता है।",diff --git a/web/i18n/locales/id-ID/common.json b/web/i18n/locales/id-ID/common.jsonindex 69b0d2b5509..6daf81975ba 100644--- a/web/i18n/locales/id-ID/common.json+++ b/web/i18n/locales/id-ID/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Dihasilkan tidak berhasil","actionMsg.modifiedSuccessfully": "Berhasil dimodifikasi","actionMsg.modifiedUnsuccessfully": "Dimodifikasi tidak berhasil",- "actionMsg.noModification": "Tidak ada modifikasi saat ini.","actionMsg.payCancelled": "Pembayaran dibatalkan","actionMsg.paySucceeded": "Pembayaran berhasil","agentStrategyPage.description": "Tentukan cara AI Agent Anda bernalar dan mengambil keputusan — termasuk memilih alat, menangani hasil, dan menyelesaikan masalah secara mandiri.",diff --git a/web/i18n/locales/it-IT/common.json b/web/i18n/locales/it-IT/common.jsonindex a6336dc36a7..b01018aa6b1 100644--- a/web/i18n/locales/it-IT/common.json+++ b/web/i18n/locales/it-IT/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generazione non riuscita","actionMsg.modifiedSuccessfully": "Modificato con successo","actionMsg.modifiedUnsuccessfully": "Modifica non riuscita",- "actionMsg.noModification": "Nessuna modifica al momento.","actionMsg.payCancelled": "Pagamento annullato","actionMsg.paySucceeded": "Pagamento riuscito","agentStrategyPage.description": "Definisci come il tuo AI Agent ragiona e prende decisioni — inclusi la selezione degli strumenti, la gestione dei risultati e la risoluzione autonoma dei problemi.",diff --git a/web/i18n/locales/ja-JP/common.json b/web/i18n/locales/ja-JP/common.jsonindex 5d81eaf4638..1c58e8f495c 100644--- a/web/i18n/locales/ja-JP/common.json+++ b/web/i18n/locales/ja-JP/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "生成が失敗しました","actionMsg.modifiedSuccessfully": "変更が正常に行われました","actionMsg.modifiedUnsuccessfully": "変更が失敗しました",- "actionMsg.noModification": "現在は変更されていません。","actionMsg.payCancelled": "支払いがキャンセルされました","actionMsg.paySucceeded": "支払いが成功しました","agentStrategyPage.description": "AI エージェントの推論と意思決定の方法を定義します——ツールの選び方、結果の扱い方、問題を自律的に解決する方法までを設定できます。",diff --git a/web/i18n/locales/ko-KR/common.json b/web/i18n/locales/ko-KR/common.jsonindex cd74c4d0dab..1cd356776a5 100644--- a/web/i18n/locales/ko-KR/common.json+++ b/web/i18n/locales/ko-KR/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "생성에 실패했습니다","actionMsg.modifiedSuccessfully": "변경이 성공적으로 이루어졌습니다","actionMsg.modifiedUnsuccessfully": "변경에 실패했습니다",- "actionMsg.noModification": "현재 변경사항이 없습니다.","actionMsg.payCancelled": "결제가 취소되었습니다","actionMsg.paySucceeded": "결제가 성공했습니다","agentStrategyPage.description": "AI Agent가 어떻게 추론하고 의사결정하는지 정의하세요. 도구 선택, 결과 처리, 자율적인 문제 해결을 포함합니다.",diff --git a/web/i18n/locales/lo-LA/common.json b/web/i18n/locales/lo-LA/common.jsonindex d97954a8ed3..47106301f63 100644--- a/web/i18n/locales/lo-LA/common.json+++ b/web/i18n/locales/lo-LA/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "ສ້າງບໍ່ສຳເລັດ","actionMsg.modifiedSuccessfully": "ແກ້ໄຂສຳເລັດແລ້ວ","actionMsg.modifiedUnsuccessfully": "ແກ້ໄຂບໍ່ສຳເລັດ",- "actionMsg.noModification": "ບໍ່ມີການແກ້ໄຂໃນຕອນນີ້.","actionMsg.payCancelled": "ຍົກເລີກການຊຳລະເງິນ","actionMsg.paySucceeded": "ຊຳລະເງິນສຳເລັດແລ້ວ","agentStrategyPage.description": "ກຳນົດວິທີທີ່ຕົວແທນ AI ຂອງທ່ານໃຊ້ເຫດຜົນ ແລະ ຕັດສິນໃຈ — ລວມທັງວິທີການເລືອກເຄື່ອງມື, ຈັດການຜົນລັດ ແລະ ແກ້ໄຂບັນຫາດ້ວຍຕົນເອງ.",diff --git a/web/i18n/locales/nl-NL/common.json b/web/i18n/locales/nl-NL/common.jsonindex e727232153a..cdf7efe6b4e 100644--- a/web/i18n/locales/nl-NL/common.json+++ b/web/i18n/locales/nl-NL/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generated unsuccessfully","actionMsg.modifiedSuccessfully": "Modified successfully","actionMsg.modifiedUnsuccessfully": "Modified unsuccessfully",- "actionMsg.noModification": "No modifications at the moment.","actionMsg.payCancelled": "Payment cancelled","actionMsg.paySucceeded": "Payment succeeded","agentStrategyPage.description": "Bepaal hoe je AI Agent redeneert en beslissingen neemt — inclusief hoe tools worden gekozen, resultaten worden verwerkt en problemen zelfstandig worden opgelost.",diff --git a/web/i18n/locales/pl-PL/common.json b/web/i18n/locales/pl-PL/common.jsonindex eab61ee8e80..9ba1d443127 100644--- a/web/i18n/locales/pl-PL/common.json+++ b/web/i18n/locales/pl-PL/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Nie udało się wygenerować","actionMsg.modifiedSuccessfully": "Zmodyfikowano pomyślnie","actionMsg.modifiedUnsuccessfully": "Nie udało się zmodyfikować",- "actionMsg.noModification": "W tej chwili brak zmian.","actionMsg.payCancelled": "Płatność anulowana","actionMsg.paySucceeded": "Płatność zakończona sukcesem","agentStrategyPage.description": "Określ, jak Twój AI Agent rozumuje i podejmuje decyzje — w tym jak wybiera narzędzia, obsługuje wyniki i samodzielnie rozwiązuje problemy.",diff --git a/web/i18n/locales/pt-BR/common.json b/web/i18n/locales/pt-BR/common.jsonindex 857e9cdb5c3..982be2333ff 100644--- a/web/i18n/locales/pt-BR/common.json+++ b/web/i18n/locales/pt-BR/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Geração sem sucesso","actionMsg.modifiedSuccessfully": "Modificado com sucesso","actionMsg.modifiedUnsuccessfully": "Modificado sem sucesso",- "actionMsg.noModification": "Sem modificações no momento.","actionMsg.payCancelled": "Pagamento cancelado","actionMsg.paySucceeded": "Pagamento realizado com sucesso","agentStrategyPage.description": "Defina como seu AI Agent raciocina e toma decisões — incluindo como seleciona ferramentas, lida com resultados e resolve problemas de forma autônoma.",diff --git a/web/i18n/locales/ro-RO/common.json b/web/i18n/locales/ro-RO/common.jsonindex 6fbdeac112a..50fb2c86b29 100644--- a/web/i18n/locales/ro-RO/common.json+++ b/web/i18n/locales/ro-RO/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generare eșuată","actionMsg.modifiedSuccessfully": "Modificat cu succes","actionMsg.modifiedUnsuccessfully": "Modificare eșuată",- "actionMsg.noModification": "Nicio modificare în acest moment.","actionMsg.payCancelled": "Plata a fost anulată","actionMsg.paySucceeded": "Plata a reușit","agentStrategyPage.description": "Definește cum raționează și ia decizii AI Agent — inclusiv cum selectează instrumente, gestionează rezultate și rezolvă autonom probleme.",diff --git a/web/i18n/locales/ru-RU/common.json b/web/i18n/locales/ru-RU/common.jsonindex 1b7aa38b41e..39c27c2e4c7 100644--- a/web/i18n/locales/ru-RU/common.json+++ b/web/i18n/locales/ru-RU/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Сгенерировано неудачно","actionMsg.modifiedSuccessfully": "Изменено успешно","actionMsg.modifiedUnsuccessfully": "Изменено неудачно",- "actionMsg.noModification": "На данный момент нет изменений.","actionMsg.payCancelled": "Оплата отменена","actionMsg.paySucceeded": "Оплата прошла успешно","agentStrategyPage.description": "Определите, как ваш AI Agent рассуждает и принимает решения — как выбирает инструменты, обрабатывает результаты и автономно решает задачи.",diff --git a/web/i18n/locales/sl-SI/common.json b/web/i18n/locales/sl-SI/common.jsonindex 2625ba5b1cc..0969c58a855 100644--- a/web/i18n/locales/sl-SI/common.json+++ b/web/i18n/locales/sl-SI/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Generirano neuspešno","actionMsg.modifiedSuccessfully": "Spremenjeno uspešno","actionMsg.modifiedUnsuccessfully": "Spremenjeno neuspešno",- "actionMsg.noModification": "Trenutno ni sprememb.","actionMsg.payCancelled": "Plačilo preklicano","actionMsg.paySucceeded": "Plačilo je uspelo","agentStrategyPage.description": "Določite, kako vaš AI Agent razmišlja in sprejema odločitve — vključno z izbiro orodij, obdelavo rezultatov in samostojnim reševanjem težav.",diff --git a/web/i18n/locales/th-TH/common.json b/web/i18n/locales/th-TH/common.jsonindex 87da8345e94..a3b88d3dea1 100644--- a/web/i18n/locales/th-TH/common.json+++ b/web/i18n/locales/th-TH/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "สร้างไม่สําเร็จ","actionMsg.modifiedSuccessfully": "แก้ไขสําเร็จแล้ว","actionMsg.modifiedUnsuccessfully": "แก้ไขไม่สําเร็จ",- "actionMsg.noModification": "ไม่มีการดัดแปลงในขณะนี้","actionMsg.payCancelled": "ยกเลิกการชําระเงิน","actionMsg.paySucceeded": "การชําระเงินสําเร็จ","agentStrategyPage.description": "กำหนดวิธีที่ AI Agent ของคุณใช้เหตุผลและตัดสินใจ — รวมถึงการเลือกเครื่องมือ การจัดการผลลัพธ์ และการแก้ปัญหาโดยอัตโนมัติ",diff --git a/web/i18n/locales/tr-TR/common.json b/web/i18n/locales/tr-TR/common.jsonindex 2b93f801a77..a948e2e2f51 100644--- a/web/i18n/locales/tr-TR/common.json+++ b/web/i18n/locales/tr-TR/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Oluşturma başarısız oldu","actionMsg.modifiedSuccessfully": "Başarıyla değiştirildi","actionMsg.modifiedUnsuccessfully": "Değiştirme başarısız oldu",- "actionMsg.noModification": "Şu an için değişiklik yok.","actionMsg.payCancelled": "Ödeme iptal edildi","actionMsg.paySucceeded": "Ödeme başarılı oldu","agentStrategyPage.description": "AI Agent’ın nasıl akıl yürüttüğünü ve karar verdiğini tanımlayın — araç seçimi, sonuçları işleme ve sorunları otonom çözme dahil.",diff --git a/web/i18n/locales/uk-UA/common.json b/web/i18n/locales/uk-UA/common.jsonindex 35c3f7ebf65..68960092597 100644--- a/web/i18n/locales/uk-UA/common.json+++ b/web/i18n/locales/uk-UA/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Не вдалося згенерувати","actionMsg.modifiedSuccessfully": "Успішно змінено","actionMsg.modifiedUnsuccessfully": "Змінити не вдалося",- "actionMsg.noModification": "На даний момент жодних змін немає.","actionMsg.payCancelled": "Платіж скасовано","actionMsg.paySucceeded": "Платіж пройшов успішно","agentStrategyPage.description": "Визначте, як ваш AI Agent міркує та ухвалює рішення — як вибирає інструменти, обробляє результати й автономно розв’язує задачі.",diff --git a/web/i18n/locales/vi-VN/common.json b/web/i18n/locales/vi-VN/common.jsonindex 9beaf6335de..e7a4925acf6 100644--- a/web/i18n/locales/vi-VN/common.json+++ b/web/i18n/locales/vi-VN/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "Tạo không thành công","actionMsg.modifiedSuccessfully": "Chỉnh sửa thành công","actionMsg.modifiedUnsuccessfully": "Chỉnh sửa không thành công",- "actionMsg.noModification": "Hiện không có sự thay đổi.","actionMsg.payCancelled": "Thanh toán đã hủy","actionMsg.paySucceeded": "Thanh toán thành công","agentStrategyPage.description": "Xác định cách AI Agent suy luận và ra quyết định — bao gồm cách chọn công cụ, xử lý kết quả và tự động giải quyết vấn đề.",diff --git a/web/i18n/locales/zh-Hans/common.json b/web/i18n/locales/zh-Hans/common.jsonindex c9aa0100372..5d4107d78bb 100644--- a/web/i18n/locales/zh-Hans/common.json+++ b/web/i18n/locales/zh-Hans/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "生成失败","actionMsg.modifiedSuccessfully": "修改成功","actionMsg.modifiedUnsuccessfully": "修改失败",- "actionMsg.noModification": "暂无修改","actionMsg.payCancelled": "已取消支付","actionMsg.paySucceeded": "已支付成功","agentStrategyPage.description": "定义 AI Agent 的推理与决策方式——包括它如何选择工具、处理结果、自主解决问题。",diff --git a/web/i18n/locales/zh-Hant/common.json b/web/i18n/locales/zh-Hant/common.jsonindex f9d9c127370..a820ddb86aa 100644--- a/web/i18n/locales/zh-Hant/common.json+++ b/web/i18n/locales/zh-Hant/common.json@@ -10,7 +10,6 @@"actionMsg.generatedUnsuccessfully": "生成失敗","actionMsg.modifiedSuccessfully": "修改成功","actionMsg.modifiedUnsuccessfully": "修改失敗",- "actionMsg.noModification": "暫無修改","actionMsg.payCancelled": "已取消支付","actionMsg.paySucceeded": "已支付成功","agentStrategyPage.description": "定義 AI Agent 的推理與決策方式,包括如何選擇工具、處理結果並自主解決問題。",diff --git a/web/i18n/resources.generated.d.ts b/web/i18n/resources.generated.d.tsindex 31c05c8e8d9..a61edbdd6c8 100644--- a/web/i18n/resources.generated.d.ts+++ b/web/i18n/resources.generated.d.ts@@ -1561,7 +1561,6 @@ export default interface Resources {'actionMsg.generatedUnsuccessfully': 'Generated unsuccessfully''actionMsg.modifiedSuccessfully': 'Modified successfully''actionMsg.modifiedUnsuccessfully': 'Modified unsuccessfully'- 'actionMsg.noModification': 'No modifications at the moment.''actionMsg.payCancelled': 'Payment cancelled''actionMsg.paySucceeded': 'Payment succeeded''agentStrategyPage.description': 'Define how your AI agent reasons and makes decisions — including how it selects tools, handles results, and solves problems autonomously.'diff --git a/web/service/console/client.spec.ts b/web/service/console/client.spec.tsindex be80aa86d00..c19415355ea 100644--- a/web/service/console/client.spec.ts+++ b/web/service/console/client.spec.ts@@ -7,7 +7,7 @@ import type { consoleQuery as ConsoleQuery } from '@/service/console'import { MutationObserver, QueryClient, QueryObserver } from '@tanstack/react-query'import { afterEach, beforeEach, describe, expect, it, vi } from 'vite-plus/test'import { createAgentFixture } from '@/test/fixtures/agent'-import { createAppDetailFixture } from '@/test/fixtures/app'+import { createAppDetailFixture, createAppSiteFixture } from '@/test/fixtures/app'import { normalizeConsoleOpenAPIURL } from './openapi-url'const loadConsoleQuery = async () => {@@ -653,6 +653,41 @@ describe('consoleQuery account profile mutation defaults', () => {})describe('consoleQuery app mutation defaults', () => {+ it('should merge the reset token into the exact app site without replacing other detail fields', async () => {+ const consoleQuery = await loadConsoleQuery()+ const queryClient = new QueryClient()+ const input = { params: { app_id: 'app-1' } }+ const detailKey = consoleQuery.apps.byAppId.get.queryKey({ input })+ const otherKey = consoleQuery.apps.byAppId.get.queryKey({+ input: { params: { app_id: 'app-2' } },+ })+ const original = createAppDetailFixture({ site: createAppSiteFixture() })+ const other = createAppDetailFixture({ id: 'app-2' })+ queryClient.setQueryData(detailKey, original)+ queryClient.setQueryData(otherKey, other)+ const response: AppSiteResponse = {+ app_id: 'app-1',+ code: 'new-site-code',+ customize_token_strategy: 'fixed',+ default_language: 'en-US',+ prompt_public: false,+ show_workflow_steps: false,+ title: 'Unrelated response field',+ use_icon_as_answer_icon: false,+ }++ await consoleQuery.apps.byAppId.site.accessTokenReset.post+ .mutationOptions()+ .onSettled?.(response, null, input, undefined, createMutationContext(queryClient))++ expect(queryClient.getQueryData(detailKey)).toEqual({+ ...original,+ site: { ...original.site, code: response.code, access_token: response.code },+ })+ expect(queryClient.getQueryData(otherKey)).toEqual(other)+ expect(original.site?.access_token).toBe('site-token')+ })+it('should invalidate the exact app detail after access mutations', async () => {const consoleQuery = await loadConsoleQuery()const queryClient = new QueryClient()@@ -723,6 +758,52 @@ describe('consoleQuery app mutation defaults', () => {})})+ it.each(['api', 'site'] as const)(+ 'keeps complete detail and other apps when updating %s access',+ async (kind) => {+ const consoleQuery = await loadConsoleQuery()+ const queryClient = new QueryClient()+ const input = { params: { app_id: 'app-1' } }+ const detailKey = consoleQuery.apps.byAppId.get.queryKey({ input })+ const otherKey = consoleQuery.apps.byAppId.get.queryKey({+ input: { params: { app_id: 'app-2' } },+ })+ const original = createAppDetailFixture({ enable_api: true, enable_site: true })+ const other = createAppDetailFixture({ id: 'app-2' })+ queryClient.setQueryData(detailKey, original)+ queryClient.setQueryData(otherKey, other)+ const updated = createAppDetailFixture({+ name: 'Unrelated response field',+ enable_api: false,+ enable_site: false,+ })+ const context = createMutationContext(queryClient)++ if (kind === 'api') {+ await consoleQuery.apps.byAppId.apiEnable.post+ .mutationOptions()+ .onSettled?.(updated, null, { ...input, body: { enable_api: false } }, undefined, context)+ } else {+ await consoleQuery.apps.byAppId.siteEnable.post+ .mutationOptions()+ .onSettled?.(+ updated,+ null,+ { ...input, body: { enable_site: false } },+ undefined,+ context,+ )+ }++ expect(queryClient.getQueryData(detailKey)).toEqual({+ ...original,+ [kind === 'api' ? 'enable_api' : 'enable_site']: false,+ updated_at: updated.updated_at,+ })+ expect(queryClient.getQueryData(otherKey)).toEqual(other)+ },+ )+it('should write an updated app into its exact detail cache', async () => {const consoleQuery = await loadConsoleQuery()const queryClient = new QueryClient()diff --git a/web/service/console/query-policies.ts b/web/service/console/query-policies.tsindex cc326e75679..083d507245d 100644--- a/web/service/console/query-policies.ts+++ b/web/service/console/query-policies.ts@@ -3,6 +3,7 @@ import type {AgentAppPagination,} from '@dify/contracts/api/console/agent/types.gen'import type { ApiBasedExtensionResponse } from '@dify/contracts/api/console/api-based-extension/types.gen'+import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gen'import type { TagResponse as Tag } from '@dify/contracts/api/console/tags/types.gen'import type { RouterUtils } from '@orpc/tanstack-query'import type { InfiniteData, QueryClient, QueryKey } from '@tanstack/react-query'@@ -342,8 +343,16 @@ export function createConsoleQuery(consoleClient: ConsoleClient) {apiEnable: {post: {mutationOptions: {- onSettled: (_data, error, variables, _onMutateResult, context) => {- if (error) return+ onSettled: (data, error, variables, _onMutateResult, context) => {+ if (error || !data) return++ context.client.setQueryData<AppDetailWithSite>(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: variables.params } }),+ (detail) =>+ detail+ ? { ...detail, enable_api: data.enable_api, updated_at: data.updated_at }+ : undefined,+ )void context.client.invalidateQueries({queryKey: consoleQuery.apps.byAppId.get.queryKey({@@ -392,8 +401,16 @@ export function createConsoleQuery(consoleClient: ConsoleClient) {siteEnable: {post: {mutationOptions: {- onSettled: (_data, error, variables, _onMutateResult, context) => {- if (error) return+ onSettled: (data, error, variables, _onMutateResult, context) => {+ if (error || !data) return++ context.client.setQueryData<AppDetailWithSite>(+ consoleQuery.apps.byAppId.get.queryKey({ input: { params: variables.params } }),+ (detail) =>+ detail+ ? { ...detail, enable_site: data.enable_site, updated_at: data.updated_at }+ : undefined,+ )void context.client.invalidateQueries({queryKey: consoleQuery.apps.byAppId.get.queryKey({@@ -405,11 +422,46 @@ export function createConsoleQuery(consoleClient: ConsoleClient) {},},site: {+ post: {+ mutationOptions: {+ onSettled: (_data, error, variables, _onMutateResult, context) => {+ if (error) return+ void context.client.invalidateQueries({+ queryKey: consoleQuery.apps.byAppId.get.queryKey({+ input: { params: variables.params },+ }),+ })+ void context.client.invalidateQueries({ queryKey: consoleQuery.apps.get.key() })+ void context.client.invalidateQueries({+ queryKey: consoleQuery.apps.starred.get.key(),+ })+ void context.client.invalidateQueries({+ queryKey: consoleQuery.apps.recent.get.key(),+ })+ },+ },+ },accessTokenReset: {post: {mutationOptions: {- onSettled: (_data, error, variables, _onMutateResult, context) => {- if (error) return+ onSettled: (data, error, variables, _onMutateResult, context) => {+ if (error || !data) return++ const { code } = data+ if (code !== undefined) {+ context.client.setQueryData<AppDetailWithSite>(+ consoleQuery.apps.byAppId.get.queryKey({+ input: { params: variables.params },+ }),+ (detail) =>+ detail?.site+ ? {+ ...detail,+ site: { ...detail.site, code, access_token: code },+ }+ : detail,+ )+ }void context.client.invalidateQueries({queryKey: consoleQuery.apps.byAppId.get.queryKey({