Skip to content

Commit 2ca5031

Browse files
committed
fix params issue
1 parent 998c003 commit 2ca5031

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

  • apps/codebility/app/home/kanban/[projectId]/[id]

‎apps/codebility/app/home/kanban/[projectId]/[id]/page.tsx‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"use client";
22

3-
import { useEffect, useMemo, useState } from "react";
3+
import { use, useEffect, useMemo, useState } from "react";
44
import { useKanbanStore } from "@/store/kanban-store";
55
import { KanbanBoardType, KanbanColumnType, Task } from "@/types/home/codev";
66

77
import KanbanBoard from "./_components/KanbanBoard";
88
import KanbanLoadingSkeleton from "./loading";
99

1010
interface KanbanBoardPageProps {
11-
params: { id: string; projectId: string };
12-
searchParams?: { query?: string };
11+
params: Promise<{ id: string; projectId: string }>;
12+
searchParams?: Promise<{ query?: string }>;
1313
}
1414

1515
// Mapping functions to convert raw data into our expected types.
@@ -47,20 +47,20 @@ const mapColumn = (column: any): KanbanColumnType => ({
4747
: [],
4848
});
4949

50-
export default function KanbanBoardPage({
51-
params,
52-
searchParams,
53-
}: KanbanBoardPageProps) {
50+
export default function KanbanBoardPage(props: KanbanBoardPageProps) {
5451
const { boardData, fetchBoardData, setBoardId } = useKanbanStore();
5552
const [loading, setLoading] = useState(true);
5653

54+
// ✅ unwrap params and searchParams
55+
const { id, projectId } = use(props.params);
56+
const searchParams = props.searchParams ? use(props.searchParams) : {};
5757
const query = searchParams?.query?.toLowerCase() || "";
5858

5959
useEffect(() => {
6060
const loadData = async () => {
6161
setLoading(true);
6262
try {
63-
setBoardId(params.id); // no need to await if this is a Zustand setter
63+
setBoardId(id);
6464
await fetchBoardData();
6565
} catch (err) {
6666
console.error("Failed to load board data:", err);
@@ -69,7 +69,7 @@ export default function KanbanBoardPage({
6969
}
7070
};
7171
loadData();
72-
}, [params.id, fetchBoardData, setBoardId]);
72+
}, [id, fetchBoardData, setBoardId]);
7373

7474
const processedBoardData = useMemo(() => {
7575
if (!boardData) return null;
@@ -109,7 +109,5 @@ export default function KanbanBoardPage({
109109
return <div>Board not found</div>;
110110
}
111111

112-
return (
113-
<KanbanBoard projectId={params.projectId} boardData={processedBoardData} />
114-
);
112+
return <KanbanBoard projectId={projectId} boardData={processedBoardData} />;
115113
}

0 commit comments

Comments
 (0)