Skip to content

Commit

Permalink
Always pass aspect cwd to avoid undesired caching
Browse files Browse the repository at this point in the history
  • Loading branch information
villasv committed Dec 30, 2023
1 parent aaf8021 commit 17e851d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app/(aspects)/coffee/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from "path";
import { AspectIndex } from "@/components/aspect";

const cwd = path.basename(__dirname);
export default async function Page() {
return <AspectIndex />;
return <AspectIndex base={cwd} />;
}
4 changes: 3 additions & 1 deletion app/(aspects)/food/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from "path";
import { AspectIndex } from "@/components/aspect";

const cwd = path.basename(__dirname);
export default async function Page() {
return <AspectIndex />;
return <AspectIndex base={cwd} />;
}
4 changes: 3 additions & 1 deletion app/(aspects)/sport/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from "path";
import { AspectIndex } from "@/components/aspect";

const cwd = path.basename(__dirname);
export default async function Page() {
return <AspectIndex />;
return <AspectIndex base={cwd} />;
}
4 changes: 3 additions & 1 deletion app/(aspects)/words/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from "path";
import { AspectIndex } from "@/components/aspect";

const cwd = path.basename(__dirname);
export default async function Page() {
return <AspectIndex />;
return <AspectIndex base={cwd} />;
}
4 changes: 3 additions & 1 deletion app/(aspects)/world/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from "path";
import { AspectIndex } from "@/components/aspect";

const cwd = path.basename(__dirname);
export default async function Page() {
return <AspectIndex />;
return <AspectIndex base={cwd} />;
}
14 changes: 9 additions & 5 deletions components/aspect/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import path from "path";
import { listPages } from "@/components/factory";
import styles from "./aspect.module.css";

export interface AspectProps {}
export interface AspectProps {
/**
* The base folder name used to list all sub pages in the aspect root page.
* Will inspect all files matching app/(aspects)/{base}/.../page.*
*/
base: string;
}

export async function AspectIndex({}: AspectProps) {
const cwd = path.basename(__dirname);
const subPages = await listPages("app/(aspects)", cwd, 1);
export async function AspectIndex({ base }: AspectProps) {
const subPages = await listPages("app/(aspects)", base, 1);
return (
<div className={styles.aspect}>
<ol>
Expand Down

0 comments on commit 17e851d

Please sign in to comment.