1'use client';23import { useParams } from 'next/navigation';4import { useEffect } from 'react';56export function StudioWorkspaceProvider({ children }) {7 const params = useParams<{ workspaceAlias?: string }>();8 9 useEffect(() => {10 console.log('workspaceAlias:', params.workspaceAlias);11 // Expected: "cmiv5jlg10000dzibtoqkmqvh"12 // Actual (sometimes): "%%drp:workspaceAlias:dd80498a69064%%"13 }, [params.workspaceAlias]);1415 return <>{children}</>;16}
Same problem occurs. useParams() returns build-time placeholder value %%drp:...%% in client component during production build
next@16.0.8, cacheComponents: true
Update: I found that the issue was resolved by setting prefetch={false} on the Link component. It seems the problem occurs when is combined with dynamicIO. During prefetching, dynamic params are replaced with placeholders, and these placeholder values leak into useParams() in client components.
%%drp:paramName:hash%% placeholder appears to be used internally by Next.js during PPR (Partial Prerendering) to represent dynamic route parameters that are unknown at build/prefetch time.
Expected flow:
- Prefetch generates static shell with placeholders
- On navigation, placeholders are replaced with actual values
- Client components receive real params via
useParams()
Actual flow (bug):
- Prefetch generates static shell with placeholders
- Client component hydrates before placeholder replacement
useParams() returns raw placeholder string %%drp:...%%
This suggests a race condition or incorrect hydration order when dynamicIO is enabled with Link prefetching.