mirror of
https://github.com/langgenius/dify.git
synced 2026-07-21 10:38:32 +08:00
refactor(web): remove basePath from hydration boundary (#39308)
This commit is contained in:
parent
ef0115d340
commit
b7193d1cba
@ -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')
|
||||
|
||||
@ -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}`
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user