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.

fix: unnecessory data fetch when swithing apps category on explore page (#5155)

doufae05183c7d249
diff --git a/web/hooks/use-tab-searchparams.ts b/web/hooks/use-tab-searchparams.ts
index 6a665bca5a1..3009923ea7d 100644
--- a/web/hooks/use-tab-searchparams.ts
+++ b/web/hooks/use-tab-searchparams.ts
@@ -1,4 +1,4 @@
-import { usePathname, useRouter, useSearchParams } from 'next/navigation'
+import { usePathname, useSearchParams } from 'next/navigation'
import { useState } from 'react'
type UseTabSearchParamsOptions = {
@@ -24,7 +24,6 @@ export const useTabSearchParams = ({
searchParamName = 'category',
disableSearchParams = false,
}: UseTabSearchParamsOptions) => {
- const router = useRouter()
const pathName = usePathname()
const searchParams = useSearchParams()
const [activeTab, setTab] = useState<string>(
@@ -37,7 +36,7 @@ export const useTabSearchParams = ({
setTab(newActiveTab)
if (disableSearchParams)
return
- router[routingBehavior](`${pathName}?${searchParamName}=${newActiveTab}`)
+ history[`${routingBehavior}State`](null, '', `${pathName}?${searchParamName}=${newActiveTab}`)
}
return [activeTab, setActiveTab] as const