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:
copilot-swe-agent[bot] 2026-01-10 06:05:36 +00:00
parent cdf926cf82
commit b3b20a999a

View File

@ -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)