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(web): remove basePath from hydration boundary (#39308)

yyhb7193d1cba49
diff --git a/web/app/(commonLayout)/__tests__/hydration-boundary.spec.tsx b/web/app/(commonLayout)/__tests__/hydration-boundary.spec.tsx
index 82878ebc600..b34faae8248 100644
--- a/web/app/(commonLayout)/__tests__/hydration-boundary.spec.tsx
+++ b/web/app/(commonLayout)/__tests__/hydration-boundary.spec.tsx
@@ -107,7 +107,7 @@ describe('CommonLayoutHydrationBoundary', () => {
})
})
- it('should hydrate common layout queries and render children', async () => {
+ it('should prefetch common layout queries and render children', async () => {
const { CommonLayoutHydrationBoundary } = await import('../hydration-boundary')
const element = await CommonLayoutHydrationBoundary({
@@ -147,7 +147,8 @@ describe('CommonLayoutHydrationBoundary', () => {
)
})
- it('should default unauthorized refresh redirects to the home path when the pathname header is missing', async () => {
+ it('should use the internal home path when the pathname header is missing', async () => {
+ mocks.basePath = '/workflow'
mocks.headers.mockResolvedValue(new Headers())
mocks.profileQueryFn.mockRejectedValue(
new Response(JSON.stringify({ code: 'unauthorized' }), { status: 401 }),
@@ -162,7 +163,7 @@ describe('CommonLayoutHydrationBoundary', () => {
it.each([
['not_setup', '/install'],
['not_init_validated', '/init'],
- ])('should use a basePath-relative destination for %s errors', async (code, destination) => {
+ ])('should use an internal destination for %s errors', async (code, destination) => {
mocks.basePath = '/workflow'
mocks.profileQueryFn.mockRejectedValue(new Response(JSON.stringify({ code }), { status: 401 }))
const { CommonLayoutHydrationBoundary } = await import('../hydration-boundary')
diff --git a/web/app/(commonLayout)/hydration-boundary.tsx b/web/app/(commonLayout)/hydration-boundary.tsx
index 74f7da57175..dda23f3e43f 100644
--- a/web/app/(commonLayout)/hydration-boundary.tsx
+++ b/web/app/(commonLayout)/hydration-boundary.tsx
@@ -10,7 +10,6 @@ import {
resolveServerConsoleApiUrl,
serverConsoleQuery,
} from '@/service/server'
-import { basePath } from '@/utils/var'
const CURRENT_PATHNAME_HEADER = 'x-dify-pathname'
const CURRENT_SEARCH_HEADER = 'x-dify-search'
@@ -35,7 +34,7 @@ const parseConsoleErrorPayload = async (error: Response): Promise<ConsoleErrorPa
const getCurrentPath = async () => {
const requestHeaders = await headers()
- const pathname = requestHeaders.get(CURRENT_PATHNAME_HEADER) || `${basePath}/`
+ const pathname = requestHeaders.get(CURRENT_PATHNAME_HEADER) || '/'
const search = requestHeaders.get(CURRENT_SEARCH_HEADER) || ''
return `${pathname}${search}`
}