Implementation:Infiniflow Ragflow RenameForm Component
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Knowledge_Base |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Zod-validated form for renaming knowledge base tags with API integration.
Description
RenameForm renders a single-field form for tag renaming. It uses react-hook-form with zodResolver and a Zod schema requiring a non-empty trimmed string. The form's id is set to TagRenameId for external submit button binding. On submit, it calls useRenameTag().renameTag with fromTag (the initial name) and toTag (the new name). A useEffect syncs the initialName prop to the form value when it changes. The modal is dismissed on successful rename.
Usage
Rendered inside a rename dialog modal within the tag table section of dataset settings.
Code Reference
Source Location
- Repository: Infiniflow_Ragflow
- File: web/src/pages/dataset/dataset-setting/tag-table/rename-dialog/rename-form.tsx
- Lines: 1-83
Signature
export function RenameForm({
initialName, hideModal,
}: IModalProps<any> & { initialName: string }): JSX.Element;
Import
import { RenameForm } from './rename-form';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| initialName | string | Yes | Current tag name to rename from |
| hideModal | function | No | Callback to close the dialog on success |
Outputs
| Name | Type | Description |
|---|---|---|
| JSX.Element | React element | Form with name input, validation, and submit binding |
Usage Examples
<RenameForm initialName="old-tag" hideModal={() => setVisible(false)} />