diff --git a/src/app/components/Charts/common/breadcrumbs/index.tsx b/src/app/components/Charts/common/breadcrumbs/index.tsx
index 9622af350..1d5323e96 100644
--- a/src/app/components/Charts/common/breadcrumbs/index.tsx
+++ b/src/app/components/Charts/common/breadcrumbs/index.tsx
@@ -7,7 +7,6 @@ import { breadCrumbItems } from "app/state/recoil/atoms";
export default function BreadCrumbs() {
const history = useHistory();
const [breadCrumbList, setBreadCrumbList] = useRecoilState(breadCrumbItems);
-
return (
{
- vizType = startCase(vizType);
-
- switch (vizType) {
- case "Pledges-contributions":
- return `Resource Mobilization: ${vizType} `;
- case "Allocations":
- return `Access to funding: ${vizType}`;
- case "Eligibility":
- return `Access to funding: ${vizType}`;
- case "Documents":
- return "Documents";
- case "Results":
- return "Results";
- default:
- return `Grant Implementation: ${vizType} `;
- }
- };
-
- const [prevVizState, setPrevVizState] = React.useState(breadCrumbList[1]);
-
- const prevViz = useMemo(() => {
- if (prevVizState !== breadCrumbList[1]) {
- setPrevVizState({
- name: vizTypePretext(params.vizType),
- path: location.pathname,
- id: v4(),
- });
- return {
- name: vizTypePretext(params.vizType),
- path: location.pathname,
- id: v4(),
- };
- }
- return prevVizState;
- }, [location.pathname]);
-
+ const breadcrumbID = useMemo(() => v4(), []);
useEffect(() => {
- if (
- breadCrumbList.length < 1 ||
- prevViz === undefined ||
- location.pathname == `/location/${params.code}/overview`
- ) {
+ if (breadCrumbList.length < 1) {
setBreadCrumList([
{ name: "Datasets", path: "/", id: v4() },
@@ -208,18 +169,22 @@ export default function CountryDetail() {
},
]);
} else {
- setBreadCrumList([
- { name: "Datasets", path: "/", id: v4() },
+ if (!breadCrumbList.find((item) => item.id === breadcrumbID))
+ setBreadCrumList([
+ ...breadCrumbList,
- {
- name: locationInfoData.locationName,
- path: `/location/${params.code}/overview`,
- id: v4(),
- },
- prevViz,
- ]);
+ {
+ name: components || locationInfoData.locationName,
+ path: location.pathname,
+ id: breadcrumbID,
+ // vizSelected:
+ },
+ // prevViz,
+ ]);
}
- }, [locationInfoData, prevViz]);
+ }, [locationInfoData]);
+
+ console.log(locationInfoData, "loc");
const tabs = countryDetailTabs;
diff --git a/src/app/modules/country-detail-module/sub-modules/overview/index.tsx b/src/app/modules/country-detail-module/sub-modules/overview/index.tsx
index 9dc7d8c6c..88c9b9ac0 100644
--- a/src/app/modules/country-detail-module/sub-modules/overview/index.tsx
+++ b/src/app/modules/country-detail-module/sub-modules/overview/index.tsx
@@ -131,7 +131,7 @@ export function LocationDetailOverviewModule(props: Props) {
margin-bottom: 8px;
`}
>
- {locationInfoData.coordinatingMechanismContacts.length > 0 && (
+ {locationInfoData.coordinatingMechanismContacts?.length > 0 && (