diff --git a/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx b/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx index 120851fad4..50593f1c20 100644 --- a/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx +++ b/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx @@ -38,7 +38,7 @@ const UnstyledResourceExplorer = (props: any) => { const dispatch: AppDispatch = useDispatch(); const classes = classNames(props); - const selectedLinks = collections ? collections.find(k => k.isDefault)!.paths : []; + const selectedLinks = collections && collections.length > 0 ? collections.find(k => k.isDefault)!.paths : []; const versions: any[] = [ { key: 'v1.0', text: 'v1.0' }, { key: 'beta', text: 'beta' } diff --git a/src/app/views/sidebar/resource-explorer/collection/PreviewCollection.tsx b/src/app/views/sidebar/resource-explorer/collection/PreviewCollection.tsx index 238cf1e71e..cf62b0e511 100644 --- a/src/app/views/sidebar/resource-explorer/collection/PreviewCollection.tsx +++ b/src/app/views/sidebar/resource-explorer/collection/PreviewCollection.tsx @@ -23,7 +23,7 @@ const PathsReview: React.FC> = (props) => { const { collections } = useAppSelector( (state) => state ); - const items = collections ? collections.find(k => k.isDefault)!.paths : []; + const items = collections && collections.length > 0 ? collections.find(k => k.isDefault)!.paths : []; const [selectedItems, setSelectedItems] = useState([]); const columns = [ diff --git a/src/app/views/sidebar/resource-explorer/command-options/CommandOptions.tsx b/src/app/views/sidebar/resource-explorer/command-options/CommandOptions.tsx index 5835b4c6cc..f009fed4a5 100644 --- a/src/app/views/sidebar/resource-explorer/command-options/CommandOptions.tsx +++ b/src/app/views/sidebar/resource-explorer/command-options/CommandOptions.tsx @@ -24,7 +24,7 @@ const CommandOptions = (props: ICommandOptions) => { const theme = getTheme(); const { collections } = useAppSelector((state) => state); - const paths = collections ? collections.find(k => k.isDefault)!.paths : []; + const paths = collections && collections.length > 0 ? collections.find(k => k.isDefault)!.paths : []; const itemStyles = resourceExplorerStyles(theme).itemStyles; const commandStyles = resourceExplorerStyles(theme).commandBarStyles; diff --git a/src/store/index.ts b/src/store/index.ts index 270367904a..c39671ca22 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -39,7 +39,8 @@ const initialState: any = { sampleHeaders: [], selectedVersion: 'v1.0' }, - termsOfUse: true + termsOfUse: true, + collections: [] }; export const store = createStore(