Feat/use searchparams as state (#2554)

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
Rozstone
2024-02-26 12:52:59 +08:00
committed by GitHub
parent ca69af7b97
commit d93288f711
7 changed files with 58 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ import EditCustomToolModal from './edit-custom-collection-modal'
import NoCustomTool from './info/no-custom-tool'
import NoSearchRes from './info/no-search-res'
import NoCustomToolPlaceholder from './no-custom-tool-placeholder'
import { useTabSearchParams } from '@/hooks/use-tab-searchparams'
import TabSlider from '@/app/components/base/tab-slider'
import { createCustomCollection, fetchCollectionList as doFetchCollectionList, fetchBuiltInToolList, fetchCustomToolList } from '@/service/tools'
import type { AgentTool } from '@/types/app'
@@ -68,7 +69,9 @@ const Tools: FC<Props> = ({
})()
const [query, setQuery] = useState('')
const [collectionType, setCollectionType] = useState<CollectionType>(collectionTypeOptions[0].value)
const [collectionType, setCollectionType] = useTabSearchParams({
defaultTab: collectionTypeOptions[0].value,
})
const showCollectionList = (() => {
let typeFilteredList: Collection[] = []