mirror of
https://github.com/YFGaia/dify-plus.git
synced 2026-06-14 20:41:21 +08:00
refactor(query-state): migrate query param state management to nuqs (#30184)
Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -16,8 +16,8 @@ let mockIsError = false
|
||||
const mockHandleImportDSL = vi.fn()
|
||||
const mockHandleImportDSLConfirm = vi.fn()
|
||||
|
||||
vi.mock('@/hooks/use-tab-searchparams', () => ({
|
||||
useTabSearchParams: () => [mockTabValue, mockSetTab],
|
||||
vi.mock('nuqs', () => ({
|
||||
useQueryState: () => [mockTabValue, mockSetTab],
|
||||
}))
|
||||
|
||||
vi.mock('ahooks', async () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
|
||||
import type { App } from '@/models/explore'
|
||||
import { useDebounceFn } from 'ahooks'
|
||||
import { useQueryState } from 'nuqs'
|
||||
import * as React from 'react'
|
||||
import { useCallback, useMemo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -15,7 +16,6 @@ import Category from '@/app/components/explore/category'
|
||||
import CreateAppModal from '@/app/components/explore/create-app-modal'
|
||||
import ExploreContext from '@/context/explore-context'
|
||||
import { useImportDSL } from '@/hooks/use-import-dsl'
|
||||
import { useTabSearchParams } from '@/hooks/use-tab-searchparams'
|
||||
import {
|
||||
DSLImportMode,
|
||||
} from '@/models/app'
|
||||
@@ -47,9 +47,8 @@ const Apps = ({
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
const [currCategory, setCurrCategory] = useTabSearchParams({
|
||||
defaultTab: allCategoriesEn,
|
||||
disableSearchParams: false,
|
||||
const [currCategory, setCurrCategory] = useQueryState('category', {
|
||||
defaultValue: allCategoriesEn,
|
||||
})
|
||||
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user