From 287c1bbc3567a0d588605fdf48feed30db10acc8 Mon Sep 17 00:00:00 2001 From: yyh Date: Fri, 6 Feb 2026 16:03:32 +0800 Subject: [PATCH] fix(skill): use nuqs query state for fileId param --- web/app/components/workflow/skill/main.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/skill/main.tsx b/web/app/components/workflow/skill/main.tsx index d0f5dc4c70..62d6b225ef 100644 --- a/web/app/components/workflow/skill/main.tsx +++ b/web/app/components/workflow/skill/main.tsx @@ -1,6 +1,6 @@ 'use client' -import { useSearchParams } from 'next/navigation' +import { parseAsString, useQueryState } from 'nuqs' import * as React from 'react' import { useStore as useAppStore } from '@/app/components/app/store' import { useStore, useWorkflowStore } from '@/app/components/workflow/store' @@ -33,17 +33,16 @@ const ContentRouter = () => { const SkillMain = () => { const appDetail = useAppStore(s => s.appDetail) const appId = appDetail?.id || '' - const searchParams = useSearchParams() + const [queryFileId] = useQueryState('fileId', parseAsString) const storeApi = useWorkflowStore() const openedFileRef = React.useRef(null) React.useEffect(() => { - const fileId = searchParams.get('fileId') - if (!fileId || openedFileRef.current === fileId) + if (!queryFileId || openedFileRef.current === queryFileId) return - openedFileRef.current = fileId - storeApi.getState().openTab(fileId, { pinned: true }) - }, [searchParams, storeApi]) + openedFileRef.current = queryFileId + storeApi.getState().openTab(queryFileId, { pinned: true }) + }, [queryFileId, storeApi]) return (