fix(sdk): wrap useSearchParams in Suspense boundary for Next.js 15
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Failing after 35s
CI / test-python-backend-compliance (push) Successful in 34s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 19s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-09 14:59:30 +01:00
parent 0affa4eb66
commit 4b778f2f85

View File

@@ -219,14 +219,12 @@ function SDKInnerLayout({ children }: { children: React.ReactNode }) {
}
// =============================================================================
// MAIN LAYOUT
// SDK ROOT WITH SEARCH PARAMS (client component that reads ?project=)
// =============================================================================
export default function SDKRootLayout({
children,
}: {
children: React.ReactNode
}) {
import { Suspense } from 'react'
function SDKRootWithParams({ children }: { children: React.ReactNode }) {
const searchParams = useSearchParams()
const projectId = searchParams.get('project') || undefined
@@ -236,3 +234,19 @@ export default function SDKRootLayout({
</SDKProvider>
)
}
// =============================================================================
// MAIN LAYOUT (wraps in Suspense for useSearchParams)
// =============================================================================
export default function SDKRootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<Suspense fallback={<div className="min-h-screen bg-gray-50" />}>
<SDKRootWithParams>{children}</SDKRootWithParams>
</Suspense>
)
}