Skip to content

Commit a409ebb

Browse files
committed
picker fix
1 parent 14a318e commit a409ebb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/sn-pickers-react/src/components/picker-advanced.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ interface PickerAdvancedProps {
278278
onSubmit?: (selectedItems: GenericContent[]) => void | undefined
279279
allowMultiple?: boolean
280280
selectionRoots?: string[]
281-
selectionRoots2?: string[]
282281
showDialogTitle?: boolean
283282
canPick?: boolean
284283
showSearch?: boolean
@@ -295,7 +294,7 @@ export const PickerAdvanced: React.FC<PickerAdvancedProps> = ({
295294
onCancel,
296295
onSubmit,
297296
allowMultiple = true,
298-
selectionRoots = ['/Root'],
297+
selectionRoots,
299298
showDialogTitle = true,
300299
canPick = true,
301300
showSearch = true,
@@ -554,9 +553,10 @@ export const PickerAdvanced: React.FC<PickerAdvancedProps> = ({
554553
</div>
555554
<div className={classes.buttonsCont}>
556555
<div className={classes.errorMsg}>
557-
{!selectionRoots.some((root) => currentPath === root || currentPath.startsWith(`${root}/`)) && (
558-
<div>Disabled Path</div>
559-
)}
556+
{selectionRoots &&
557+
!selectionRoots.some((root) => currentPath === root || currentPath.startsWith(`${root}/`)) && (
558+
<div>Disabled Path</div>
559+
)}
560560
</div>
561561
<Button
562562
type="button"
@@ -568,7 +568,8 @@ export const PickerAdvanced: React.FC<PickerAdvancedProps> = ({
568568
<Button
569569
type="button"
570570
disabled={
571-
!selectionRoots.some((root) => currentPath === root || currentPath.startsWith(`${root}/`)) ||
571+
(selectionRoots &&
572+
!selectionRoots.some((root) => currentPath === root || currentPath.startsWith(`${root}/`))) ||
572573
(isRequired && !selectedItems.length)
573574
}
574575
onClick={() => {

0 commit comments

Comments
 (0)