Skip to content

Commit

Permalink
[Issue #1251] Search Page feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySteiner authored Feb 15, 2024
1 parent 24b8295 commit 5256754
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions frontend/src/pages/search.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import type { GetStaticProps, NextPage } from "next";
import { useFeatureFlags } from "src/hooks/useFeatureFlags";

import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import PageNotFound from "./404";

const Search: NextPage = () => {
const { featureFlagsManager, mounted } = useFeatureFlags();

if (!mounted) return null;
if (!featureFlagsManager.isFeatureEnabled("showSearchV0")) {
return <PageNotFound />;
}

return <>Search Boilerplate</>;
};

// Change this to GetServerSideProps if you're using server-side rendering
export const getStaticProps: GetStaticProps = async ({ locale }) => {
const translations = await serverSideTranslations(locale ?? "en");

// TODO: update the statement below with a feature flag check
const hideSearchPage = true;
// redirects to default 404 page
if (hideSearchPage) return { notFound: true };

return { props: { ...translations } };
};

Expand Down

0 comments on commit 5256754

Please sign in to comment.