-const memoizedMapStateToProps = () => {
- let items: ResourceBreadcrumb[] = [];
- return ({ router, treePicker }: RootState): BreadcrumbsDataProps => {
- if (router.location) {
- const projectMatch = matchProjectRoute(location.pathname);
- const collectionMatch = matchProjectRoute(location.pathname);
- const uuid = projectMatch && projectMatch.params.id
- || collectionMatch && collectionMatch.params.id
- || '';
- const tree = getTreePicker(SIDE_PANEL_TREE)(treePicker);
- if (tree) {
- const ancestors = getNodeAncestors(uuid)(tree);
- const node = getNode(uuid)(tree);
- const nodes = node ? [...ancestors, node] : ancestors;
- items = nodes.map(({ value }) =>
- typeof value.value === 'string'
- ? { label: value.value, uuid: value.nodeId }
- : { label: value.value.name, uuid: value.value.uuid });
- }
- }
- return { items };
- };
-};
+const mapStateToProps = () => ({ properties, resources }: RootState): BreadcrumbsDataProps => ({
+ items: (getProperty<Breadcrumb[]>(BREADCRUMBS)(properties) || []),
+ resources,
+});