diff --git a/apps/codeforafrica/src/components/Projects/Projects.js b/apps/codeforafrica/src/components/Projects/Projects.js index 51c71676e..0d673badf 100644 --- a/apps/codeforafrica/src/components/Projects/Projects.js +++ b/apps/codeforafrica/src/components/Projects/Projects.js @@ -1,3 +1,4 @@ +/* eslint-env browser */ import { Section } from "@commons-ui/core"; import { Stack } from "@mui/material"; import { useRouter } from "next/router"; @@ -55,14 +56,12 @@ const Projects = React.forwardRef(function Projects( }, [data]); useEffect(() => { - if (router.isReady) { - const [pathname] = router.asPath.split("?"); - const url = pathname ? `${pathname}${queryParams}` : queryParams; - router.push(url, undefined, { - scroll: true, - shallow: true, - }); - } + const { pathname } = window.location; + const url = pathname ? `${pathname}${queryParams}` : queryParams; + router.push(url, undefined, { + scroll: true, + shallow: true, + }); // We don't want to listen to router changes here since we're the ones // updating them // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/apps/codeforafrica/src/lib/data/blockify/ourWork.js b/apps/codeforafrica/src/lib/data/blockify/ourWork.js index 56860cdff..34ffe94d7 100644 --- a/apps/codeforafrica/src/lib/data/blockify/ourWork.js +++ b/apps/codeforafrica/src/lib/data/blockify/ourWork.js @@ -3,8 +3,9 @@ import { getProjects } from "@/codeforafrica/lib/data/utils/projects"; async function ourWork(block, api, context) { const { query } = context; const data = await getProjects(api, query); - const { docs } = await api.getCollection("tag"); - const tags = docs.map(({ name }) => name); + const { docs: allProjects } = await api.getCollection("projects"); + const projectTags = allProjects.map(({ tag }) => tag?.name).filter(Boolean); + const tags = ["All", ...new Set(projectTags)]; return { tags,