Skip to content

Commit

Permalink
feat: next 15 downgraded to next 14
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev committed Dec 5, 2024
1 parent ca288d9 commit c1c05ec
Show file tree
Hide file tree
Showing 17 changed files with 724 additions and 778 deletions.
10 changes: 4 additions & 6 deletions apps/docs/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {Route} from "@/libs/docs/page";
import {ChevronRightLinearIcon} from "@/components/icons";

interface BlogPostProps {
params: Promise<{
params: {
slug: string;
}>;
};
}

const isDraftVisible = __DEV__ || __PREVIEW__;
Expand All @@ -38,8 +38,7 @@ async function getBlogPostFromParams({params}: BlogPostProps) {
return {post, currentRoute};
}

export async function generateMetadata(props: BlogPostProps): Promise<Metadata> {
const params = await props.params;
export async function generateMetadata({params}: BlogPostProps): Promise<Metadata> {
const {post} = await getBlogPostFromParams({params});

if (!post) {
Expand Down Expand Up @@ -79,8 +78,7 @@ export async function generateStaticParams(): Promise<BlogPostProps["params"][]>
}));
}

export default async function DocPage(props: BlogPostProps) {
const params = await props.params;
export default async function DocPage({params}: BlogPostProps) {
const {post} = await getBlogPostFromParams({params});

if (!post || (post.draft && !isDraftVisible)) {
Expand Down
12 changes: 5 additions & 7 deletions apps/docs/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {CONTENT_PATH, TAG} from "@/libs/docs/config";
import {getHeadings} from "@/libs/docs/utils";

interface DocPageProps {
params: Promise<{
params: {
slug: string[];
}>;
};
}

async function getDocFromParams({params}: DocPageProps) {
Expand All @@ -37,8 +37,7 @@ async function getDocFromParams({params}: DocPageProps) {
return {doc, headings, currentRoute};
}

export async function generateMetadata(props: DocPageProps): Promise<Metadata> {
const params = await props.params;
export async function generateMetadata({params}: DocPageProps): Promise<Metadata> {
const {doc} = await getDocFromParams({params});

if (!doc) {
Expand Down Expand Up @@ -72,14 +71,13 @@ export async function generateMetadata(props: DocPageProps): Promise<Metadata> {
};
}

export async function generateStaticParams(): Promise<DocPageProps["params"][]> {
export async function generateStaticParams(): Promise<{slug: string[]}[]> {
return allDocs.map((doc) => ({
slug: doc.slugAsParams.split("/"),
}));
}

export default async function DocPage(props: DocPageProps) {
const params = await props.params;
export default async function DocPage({params}: DocPageProps) {
const {doc, headings, currentRoute} = await getDocFromParams({params});

if (!doc) {
Expand Down
Loading

0 comments on commit c1c05ec

Please sign in to comment.