diff --git a/packages/sn-pickers-react/src/components/picker/picker-helper.tsx b/packages/sn-pickers-react/src/components/picker/picker-helper.tsx index ef15db309..3f5e948c1 100644 --- a/packages/sn-pickers-react/src/components/picker/picker-helper.tsx +++ b/packages/sn-pickers-react/src/components/picker/picker-helper.tsx @@ -1,4 +1,4 @@ -import { CircularProgress, Link } from '@material-ui/core' +import { CircularProgress, Link, Tooltip } from '@material-ui/core' import { Repository } from '@sensenet/client-core' import React, { memo } from 'react' import { usePickerHelper } from './picker-helper.hook' @@ -51,28 +51,31 @@ export const PickerHelper = ({ return (
- {isAncestorOfRoot && ( - handleJumpToCurrentPath(contextPath || '')} - className={styles}> - {currentContentText || 'Current Content'} - + {isAncestorOfRoot && contextPath && ( + + handleJumpToCurrentPath(contextPath)} + className={styles}> + {currentContentText || 'Current Content'} + + )} {helperPaths.length > 0 && (
{helperPaths.map((path) => { return ( - handleJumpToCurrentPath(path.Path)} - className={styles}> - {path.DisplayName || path.Name} - + + handleJumpToCurrentPath(path.Path)} + className={styles}> + {path.DisplayName || path.Name} + + ) })}
diff --git a/packages/sn-pickers-react/src/hooks/use-tree-picker.ts b/packages/sn-pickers-react/src/hooks/use-tree-picker.ts index fe933dd1a..dfb622e2a 100644 --- a/packages/sn-pickers-react/src/hooks/use-tree-picker.ts +++ b/packages/sn-pickers-react/src/hooks/use-tree-picker.ts @@ -1,4 +1,4 @@ -import { ConstantContent, ODataParams, ODataResponse, Repository } from '@sensenet/client-core' +import { ODataParams, Repository } from '@sensenet/client-core' import { AsyncReturnValue, PathHelper } from '@sensenet/client-utils' import { GenericContent } from '@sensenet/default-content-types' import { useCallback, useEffect, useMemo, useState } from 'react' @@ -10,8 +10,6 @@ interface State { parentId: number | undefined } -const virtualRootPath = '!VirtualRoot!' - const setParentIdAndPath = (node: T, parent?: T) => { return parent && parent.Id === node.Id ? { parentId: parent.ParentId, path: parent.Path } @@ -60,22 +58,6 @@ export const useTreePicker = - repository.load({ - idOrPath: root, - oDataOptions: options.itemsODataOptions, - }), - ), - ) - const fulfilledResults: GenericContent[] = promises - .filter((result) => result.status === 'fulfilled') - .map((result) => (result as PromiseFulfilledResult>).value.d) - - return setItems(fulfilledResults.map((item) => ({ ...item, isParent: false }))) - } - const result = await loadItems({ path: navigationPath || path, loadParent: !roots?.includes(navigationPath || path), @@ -86,15 +68,6 @@ export const useTreePicker = 1 && (roots?.includes(path) || roots?.includes(navigationPath!))) { - result.unshift({ - ...(ConstantContent.EMPTY_CONTENT as T), - isParent: true, - IsFolder: true, - Path: virtualRootPath, - }) - } - setItems(result) } catch (e) { if (!abortController.signal.aborted) {