Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow UseRenameDataset Hook

From Leeroopedia
Knowledge Sources
Domains Frontend, Knowledge_Base
Last Updated 2026-02-12 06:00 GMT

Overview

Hook for renaming datasets with payload transformation that omits server-managed fields before API submission.

Description

useRenameDataset manages the rename workflow for knowledge bases. It stores the target dataset in local state and provides modal visibility controls via useSetModalState. onDatasetRenameOk calls saveKnowledgeConfiguration with the dataset payload after using lodash omit to remove server-managed fields (id, update_time, nickname, tenant_avatar, tenant_id) and remapping id to kb_id. The modal closes on success (code 0). handleShowDatasetRenameModal sets the dataset record and opens the modal. The hook uses useUpdateKnowledge(true) for list-mode query invalidation.

Usage

Consumed by the datasets list page to handle the rename dialog lifecycle for individual knowledge bases.

Code Reference

Source Location

Signature

export const useRenameDataset = () => {
  datasetRenameLoading, initialDatasetName, onDatasetRenameOk,
  datasetRenameVisible, hideDatasetRenameModal, showDatasetRenameModal,
};

Import

import { useRenameDataset } from './use-rename-dataset';

I/O Contract

Inputs

Name Type Required Description
(none) - - Hook manages state internally

Outputs

Name Type Description
showDatasetRenameModal function Open modal with an IKnowledge record
onDatasetRenameOk function Submit rename with new name string
initialDatasetName string Current dataset name for form initialization
datasetRenameLoading boolean API call in progress

Usage Examples

const { showDatasetRenameModal, onDatasetRenameOk, datasetRenameVisible } = useRenameDataset();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment