mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
refactor: replace useResetDatasetList with useInvalidDatasetList across multiple components
This commit is contained in:
@ -11,7 +11,7 @@ import Button from '@/app/components/base/button'
|
||||
|
||||
import { ToastContext } from '@/app/components/base/toast'
|
||||
import { createEmptyDataset } from '@/service/datasets'
|
||||
import { useResetDatasetList } from '@/service/knowledge/use-dataset'
|
||||
import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
|
||||
|
||||
type IProps = {
|
||||
show: boolean
|
||||
@ -26,7 +26,7 @@ const EmptyDatasetCreationModal = ({
|
||||
const { t } = useTranslation()
|
||||
const { notify } = useContext(ToastContext)
|
||||
const router = useRouter()
|
||||
const resetDatasetList = useResetDatasetList()
|
||||
const invalidDatasetList = useInvalidDatasetList()
|
||||
|
||||
const submit = async () => {
|
||||
if (!inputValue) {
|
||||
@ -39,7 +39,7 @@ const EmptyDatasetCreationModal = ({
|
||||
}
|
||||
try {
|
||||
const dataset = await createEmptyDataset({ name: inputValue })
|
||||
resetDatasetList()
|
||||
invalidDatasetList()
|
||||
onHide()
|
||||
router.push(`/datasets/${dataset.id}/documents`)
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ import CustomDialog from '@/app/components/base/dialog'
|
||||
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
|
||||
import { noop } from 'lodash-es'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useResetDatasetList } from '@/service/knowledge/use-dataset'
|
||||
import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
|
||||
|
||||
const TextLabel: FC<PropsWithChildren> = (props) => {
|
||||
return <label className='system-sm-semibold text-text-secondary'>{props.children}</label>
|
||||
@ -556,7 +556,7 @@ const StepTwo = ({
|
||||
})
|
||||
|
||||
const isCreating = createFirstDocumentMutation.isPending || createDocumentMutation.isPending
|
||||
const resetDatasetList = useResetDatasetList()
|
||||
const invalidDatasetList = useInvalidDatasetList()
|
||||
|
||||
const createHandle = async () => {
|
||||
const params = getCreationParams()
|
||||
@ -586,7 +586,7 @@ const StepTwo = ({
|
||||
}
|
||||
if (mutateDatasetRes)
|
||||
mutateDatasetRes()
|
||||
resetDatasetList()
|
||||
invalidDatasetList()
|
||||
onStepChange && onStepChange(+1)
|
||||
isSetting && onSave && onSave()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user