From 217faab3266b52e600fcb779b926fdfc43470b33 Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Mon, 30 Sep 2024 13:54:29 +0200 Subject: [PATCH] [front] fix: parent usage in tree (#7759) --- .../DataSourceViewPermissionTree.tsx | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/front/components/DataSourceViewPermissionTree.tsx b/front/components/DataSourceViewPermissionTree.tsx index 6c87034a4d4f..fc3cdd59abf3 100644 --- a/front/components/DataSourceViewPermissionTree.tsx +++ b/front/components/DataSourceViewPermissionTree.tsx @@ -1,5 +1,4 @@ import type { - ConnectorPermission, ContentNodesViewType, DataSourceViewType, LightWorkspaceType, @@ -32,37 +31,41 @@ const getUseResourceHook = interface DataSourceViewPermissionTreeProps { dataSourceView: DataSourceViewType; - onDocumentViewClick: (documentId: string) => void; - isSearchEnabled?: boolean; isRoundedBackground?: boolean; + isSearchEnabled?: boolean; + onDocumentViewClick: (documentId: string) => void; owner: LightWorkspaceType; parentId?: string | null; - permissionFilter?: ConnectorPermission; - showExpand?: boolean; - viewType: ContentNodesViewType; selectedNodes?: Record; setSelectedNodes?: ( updater: ( prev: Record ) => Record ) => void; + showExpand?: boolean; + viewType: ContentNodesViewType; } export function DataSourceViewPermissionTree({ dataSourceView, - isSearchEnabled, isRoundedBackground, - owner, + isSearchEnabled, onDocumentViewClick, - showExpand, - viewType, + owner, + parentId, selectedNodes, setSelectedNodes, + showExpand, + viewType, }: DataSourceViewPermissionTreeProps) { const useResourcesHook = useCallback( - (parentId: string | null) => - getUseResourceHook(owner, dataSourceView, viewType)(parentId), - [owner, dataSourceView, viewType] + (selectedParentId: string | null) => + getUseResourceHook( + owner, + dataSourceView, + viewType + )(selectedParentId || parentId || null), + [owner, dataSourceView, viewType, parentId] ); return (