AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Searchparams Not Working When `CacheComponents` And `DraftMode` Are Enabled

SearchParams aren't updated on client-side navigation when experimental cacheComponents and Draft Mode are both enabled; the page always shows the initial category until a hard reload. This is a caching key omission in Next.js App Router.

highConfidence 78%Next.jsReact Server ComponentsTurbopackApp RouterAffected V16.4.0-Canary.33

Origin Analysis

With `cacheComponents` enabled, the component cache key does not include `searchParams` when Draft Mode is active. During client-side transitions, the router reuses the first cached RSC payload for the route, so `await searchParams` keeps returning the stale initial values. Underlying design flaw: the new component cache layer is not fully integrated with draft-mode dynamic rendering.
1. Enable `experimental.cacheComponents` in next.config and deploy/start the app with Draft Mode support. 2. Visit /api/draft to enable Draft Mode and redirect to /. 3. Click 'Overview' and then each category link (e.g. ?category=A). 4. Observe the paragraph always shows the same category. 5. Hard-reload the URL and see the correct category render.

Fixing Code Block

Edge Case Audit

Disables caching for this route, increasing server load; only apply to affected routes. Rollback by removing the export after upgrading to a fixed Next.js version. Not a fix for the underlying cacheComponents bug, so other routes using draft mode and searchParams may still be affected.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state