fix: remove left-over console logs and Async Params resolution.

This commit is contained in:
Prateek Singh 2025-10-13 22:21:53 +05:30
parent c4d4dda130
commit af915f7eae

View file

@ -7,22 +7,23 @@ import { Metadata } from "next";
import { parsePathForTitle} from "@/lib/utils"; import { parsePathForTitle} from "@/lib/utils";
type Props = { type Props = {
params: { params: Promise<{
domain: string; domain: string;
path: string[]; path: string[];
}; }>;
}; };
export async function generateMetadata({ params }: Props): Promise<Metadata> { export async function generateMetadata({ params: paramsPromise }: Props): Promise<Metadata> {
let title = 'Browse'; // Default Fallback let title = 'Browse'; // Default Fallback
try { try {
const params = await paramsPromise;
title = parsePathForTitle(params.path); title = parsePathForTitle(params.path);
} catch (error) { } catch (error) {
// TODO: Maybe I need to look into a better way of handling this error. // TODO: Maybe I need to look into a better way of handling this error.
// for now, it is just a log, fallback tab title and prevents the app from crashing. // for now, it is just a log, fallback tab title and prevents the app from crashing.
console.error("Failed to generate metadata title from path:", params.path, error); console.error("Failed to generate metadata title from path:", error);
} }
return { return {
@ -44,7 +45,6 @@ export default async function BrowsePage(props: BrowsePageProps) {
} = params; } = params;
const rawPath = _rawPath.join('/'); const rawPath = _rawPath.join('/');
console.log("rawPath:", rawPath);
const { repoName, revisionName, path, pathType } = getBrowseParamsFromPathParam(rawPath); const { repoName, revisionName, path, pathType } = getBrowseParamsFromPathParam(rawPath);
return ( return (