-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Debugging infinite scroll * Moved /project/ to /projects/ * Moved /artifact/ to /artifacts/ * Added an index page for /projects/ * Need to add real Algolia credentials to GH workflows, because we render results all the time now
- Loading branch information
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { notFound } from "next/navigation"; | ||
import { cache } from "react"; | ||
import { PlasmicComponent } from "@plasmicapp/loader-nextjs"; | ||
import { PLASMIC } from "../../plasmic-init"; | ||
import { PlasmicClientRootProvider } from "../../plasmic-init-client"; | ||
import { logger } from "../../lib/logger"; | ||
|
||
const PLASMIC_COMPONENT = "ProjectPage"; | ||
export const dynamic = "force-static"; | ||
export const revalidate = false; // 3600 = 1 hour | ||
|
||
const cachedFetchComponent = cache(async (componentName: string) => { | ||
try { | ||
const plasmicData = await PLASMIC.fetchComponentData(componentName); | ||
return plasmicData; | ||
} catch (e) { | ||
logger.warn(e); | ||
return null; | ||
} | ||
}); | ||
|
||
export default async function ProjectPage() { | ||
// Get Plasmic component | ||
const plasmicData = await cachedFetchComponent(PLASMIC_COMPONENT); | ||
if (!plasmicData) { | ||
logger.warn(`Unable to get componentName=${PLASMIC_COMPONENT}`); | ||
notFound(); | ||
} | ||
const compMeta = plasmicData.entryCompMetas[0]; | ||
|
||
return ( | ||
<PlasmicClientRootProvider | ||
prefetchedData={plasmicData} | ||
pageParams={compMeta.params} | ||
> | ||
<PlasmicComponent component={compMeta.displayName} /> | ||
</PlasmicClientRootProvider> | ||
); | ||
} |