Next.js requires components using useSearchParams to be wrapped in a Suspense boundary for static page generation. Fixes build failure on /approvals (and preemptively /organization).
Unified · Split
| @@ -1,5 +1,10 @@ | ||
| 1 | +import { Suspense } from "react"; | |
| 1 | 2 | import { OrganizationSettingsView } from "@/components/organization-settings-view"; |
| 2 | 3 | |
| 3 | 4 | export default function OrganizationPage() { |
| 4 | − return <OrganizationSettingsView />; | |
| 5 | + return ( | |
| 6 | + <Suspense> | |
| 7 | + <OrganizationSettingsView /> | |
| 8 | + </Suspense> | |
| 9 | + ); | |
| 5 | 10 | } |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | "use client"; |
| 2 | 2 | |
| 3 | −import { useEffect, useMemo, useState, type FormEvent } from "react"; | |
| 3 | +import { Suspense, useEffect, useMemo, useState, type FormEvent } from "react"; | |
| 4 | 4 | import Link from "next/link"; |
| 5 | 5 | import { usePathname, useRouter, useSearchParams } from "next/navigation"; |
| 6 | 6 | import { useMutation } from "convex/react"; |
| @@ -513,7 +513,9 @@ function Sidebar() { · 506 unmodified lines | ||
| 513 | 513 | <NavLinks /> |
| 514 | 514 | </div> |
| 515 | 515 | <div className="pb-4"> |
| 516 | − <SessionInfo /> | |
| 516 | + <Suspense> | |
| 517 | + <SessionInfo /> | |
| 518 | + </Suspense> | |
| 517 | 519 | </div> |
| 518 | 520 | </aside> |
| 519 | 521 | ); |
| @@ -542,7 +544,9 @@ function MobileHeader() { · 22 unmodified lines | ||
| 542 | 544 | <NavLinks onClick={() => setOpen(false)} /> |
| 543 | 545 | </div> |
| 544 | 546 | <div className="mt-auto pb-4"> |
| 545 | − <SessionInfo /> | |
| 547 | + <Suspense> | |
| 548 | + <SessionInfo /> | |
| 549 | + </Suspense> | |
| 546 | 550 | </div> |
| 547 | 551 | </SheetContent> |
| 548 | 552 | </Sheet> |