mirror of
https://github.com/langgenius/dify.git
synced 2026-01-13 21:57:48 +08:00
Fix clearQueryParams to check window at runtime instead of using isServer constant
Replace the pre-evaluated isServer check with a direct typeof window === 'undefined' check to properly handle test scenarios where window is stubbed after module load. Co-authored-by: lyzno1 <92089059+lyzno1@users.noreply.github.com>
This commit is contained in:
parent
cdf926cf82
commit
b3b20a999a
@ -21,7 +21,6 @@ import {
|
|||||||
} from 'nuqs'
|
} from 'nuqs'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { ACCOUNT_SETTING_MODAL_ACTION } from '@/app/components/header/account-setting/constants'
|
import { ACCOUNT_SETTING_MODAL_ACTION } from '@/app/components/header/account-setting/constants'
|
||||||
import { isServer } from '@/utils/client'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modal State Query Parameters
|
* Modal State Query Parameters
|
||||||
@ -177,7 +176,7 @@ export function usePluginInstallation() {
|
|||||||
* clearQueryParams(['param1', 'param2'])
|
* clearQueryParams(['param1', 'param2'])
|
||||||
*/
|
*/
|
||||||
export function clearQueryParams(keys: string | string[]) {
|
export function clearQueryParams(keys: string | string[]) {
|
||||||
if (isServer)
|
if (typeof window === 'undefined')
|
||||||
return
|
return
|
||||||
|
|
||||||
const url = new URL(window.location.href)
|
const url = new URL(window.location.href)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user