feat: Refactor sidebar props to simplify data flow
This commit is contained in:
@@ -157,9 +157,6 @@ const useDocumentsWorkspace = ({
|
||||
const { client: apiClient } = useApi();
|
||||
|
||||
const tenantRecord = (tenant ?? null) as TenantOption | null;
|
||||
const tenantNameCandidate = tenantRecord?.name ?? tenantRecord?.slug ?? null;
|
||||
const tenantName = tenantNameCandidate ? String(tenantNameCandidate) : null;
|
||||
|
||||
const currentTenantId: Identifier | null = (tenantRecord?.id ?? null) as Identifier | null;
|
||||
|
||||
const tenantOptions: TenantOption[] = Array.isArray(tenantOptionsRaw)
|
||||
@@ -606,7 +603,6 @@ const useDocumentsWorkspace = ({
|
||||
const {
|
||||
dropOverlayState,
|
||||
handleFileDrop,
|
||||
handleFileSelection,
|
||||
uploadQueue,
|
||||
clearUploadQueue,
|
||||
resetUploadsState,
|
||||
@@ -1242,7 +1238,6 @@ const useDocumentsWorkspace = ({
|
||||
);
|
||||
|
||||
const sidebarProps = useSidebarProps({
|
||||
folderNodes,
|
||||
folderClickHandlers,
|
||||
handleFolderDelete,
|
||||
handleFolderRename,
|
||||
@@ -1252,20 +1247,6 @@ const useDocumentsWorkspace = ({
|
||||
draggedFolderId,
|
||||
handlePromptCreateFolder,
|
||||
creatingFolder,
|
||||
tags,
|
||||
handleTagCreate,
|
||||
correspondents,
|
||||
handleCorrespondentCreate,
|
||||
appStatus,
|
||||
previewActive,
|
||||
handleLogout,
|
||||
tenantName,
|
||||
tenantOptions,
|
||||
currentTenantId,
|
||||
handleTenantSelect,
|
||||
openSettings,
|
||||
handleFileSelection,
|
||||
uploadQueue,
|
||||
});
|
||||
|
||||
const contextValue = {
|
||||
@@ -1320,6 +1301,10 @@ const useDocumentsWorkspace = ({
|
||||
documentsManager,
|
||||
foldersManager,
|
||||
handleBreadcrumbNavigate,
|
||||
tenant: tenantRecord,
|
||||
tenants: tenantOptions,
|
||||
tenantOptions,
|
||||
handleTenantSelect,
|
||||
};
|
||||
|
||||
// hook callers handle rendering / routing
|
||||
|
||||
Reference in New Issue
Block a user