Skip to content

Commit 5f336c3

Browse files
committed
Update the parentId type to be an optional string | null | undefined to enhance type safety. At the same time, adjust the state initialization of related components to ensure consistency with the new type.
1 parent fd5bbd6 commit 5f336c3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docSite/content/zh-cn/docs/guide/knowledge_base/api_dataset.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type ResponseType = {
4343
// 文件列表中,单项的文件类型
4444
type FileListItem = {
4545
id: string;
46-
parentId: string | null;
46+
parentId: string | null | undefined;
4747
name: string;
4848
type: 'file' | 'folder';
4949
updateTime: Date;
@@ -59,7 +59,7 @@ type FileListItem = {
5959
{{< markdownify >}}
6060
6161
{{% alert icon=" " context="success" %}}
62-
- parentId - 父级 id,可选,或者 null。
62+
- parentId - 父级 id,可选,或者 null | undefined
6363
- searchKey - 检索词,可选
6464
{{% /alert %}}
6565
@@ -68,7 +68,7 @@ curl --location --request POST '{{baseURL}}/v1/file/list' \
6868
--header 'Authorization: Bearer {{authorization}}' \
6969
--header 'Content-Type: application/json' \
7070
--data-raw '{
71-
"parentId": null,
71+
"parentId": "",
7272
"searchKey": ""
7373
}'
7474
```

packages/global/common/parentFolder/type.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export type GetPathProps = {
44
};
55

66
export type ParentTreePathItemType = {
7-
parentId: string | null;
7+
parentId: ParentIdType;
88
parentName: string;
99
};
1010
export type ParentIdType = string | null | undefined;

projects/app/src/pageComponents/dataset/detail/Import/diffSource/APIDataset.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const CustomAPIFileInput = () => {
4848

4949
const [selectFiles, setSelectFiles] = useState<APIFileItem[]>([]);
5050
const [parent, setParent] = useState<ParentTreePathItemType>({
51-
parentId: null,
51+
parentId: '',
5252
parentName: ''
5353
});
5454
const [paths, setPaths] = useState<ParentTreePathItemType[]>([]);

0 commit comments

Comments
 (0)