Skip to content

fix: resolve cacheComponents build error with @clerk/nextjs canary#1

Merged
Pmacdon15 merged 1 commit into
Pmacdon15:masterfrom
jacekradko:jacek/fix-cache-components-compat
Mar 7, 2026
Merged

fix: resolve cacheComponents build error with @clerk/nextjs canary#1
Pmacdon15 merged 1 commit into
Pmacdon15:masterfrom
jacekradko:jacek/fix-cache-components-compat

Conversation

@jacekradko

Copy link
Copy Markdown
Contributor

Summary

This PR demonstrates that the build error reported in clerk/javascript#7913 is resolved by the fix in clerk/javascript#7989.

The problem: next build with cacheComponents: true and a dynamic route (/test-route/[id]) failed with:

Error: Route "/test-route/[id]": Uncached data or `connection()` was accessed outside of `<Suspense>`.

The fix: @clerk/nextjs@7.0.2-canary.v20260305143125 removes usePathname from the internal navigation hook when cacheComponents is enabled, which was the source of the dynamic data access outside Suspense.

Changes

  • Updated @clerk/nextjs to 7.0.2-canary.v20260305143125 (includes the fix)
  • Updated header.tsx to use the v7 Show component API (SignedIn/SignedOutShow)

Build output

▲ Next.js 16.1.6 (Turbopack, Cache Components)

Route (app)
┌ ○ /
├ ○ /_not-found
├ ○ /test-route
└ ◐ /test-route/[id]

○  (Static)             prerendered as static content
◐  (Partial Prerender)  prerendered as static HTML with dynamic server-streamed content

The dynamic route /test-route/[id] now correctly renders as Partial Prerender instead of failing the build.

Updates @clerk/nextjs to 7.0.2-canary.v20260305143125 which includes
the fix for the `usePathname` issue that caused builds to fail with
"Uncached data or connection() was accessed outside of <Suspense>"
when using cacheComponents with dynamic routes.

Also updates header component to use the v7 `Show` component API
(replaces `SignedIn`/`SignedOut`).

@Pmacdon15 Pmacdon15 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much

@Pmacdon15
Pmacdon15 merged commit 669a846 into Pmacdon15:master Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants