cloudflare / cloudflare/vinext

App Router: `unstable_rootParams` not propagated to actions, route handlers, `use cache`

Open
#1,452 1 comment 0 reactions 0 assignees View on GitHub
adapter-api-e2e help wanted
Dominant language
TypeScript
Stars
8.8k
Forks
406
Avg merge
2d 6h
Merged PRs (30d)
120

Description

> *This issue was created by an agent analysing CI failures from the [Next.js Deploy Suite](https://github.com/cloudflare/vinext/actions/runs/26282973805) (vinext `main` vs Next.js `v16.2.6`, 2026-05-22).*

## Problem

The App Router `unstable_rootParams` getters API does not work correctly in vinext across several call sites: not-found rendering misses the rooted layout, server actions invoked from a page do not propagate a request context that allows the getter to throw correctly, route handlers using the getter return wrong values, and `"use cache"` functions reading root params see stale or null values instead of the per-render root param values configured in `generateStaticParams`.

```
App Router rootParams getters: server action / route handler does not surface request context
```

```
use-cache: configured rootParams lang=fr region=ca, cache reads stale or null values
```

## Estimated Impact

~9 test failures across the deploy suite.

## Affected Test Suites

- `test/e2e/app-dir/app-root-params-getters/use-cache.test.ts` (5 failures)
- `test/e2e/app-dir/app-root-params-getters/simple.test.ts` (4 failures)

## Recommendation

1. **Reproduce first in vinext's own test suite.** Add a fixture under `app/[lang]/[region]/...` with `generateStaticParams`, a `"use cache"` function reading `unstable_rootParams()`, a server action that reads it, and a route handler. Confirm each call-site fails.

2. **Study the Next.js implementation.** Search `.nextjs-ref/packages/next/src/server/request/` for `rootParams` and `unstable_rootParams` to understand how the per-request root-params context is threaded through the render, action, and route-handler dispatch paths.

3. **Thread root params through every request-scoped entry point.** Wire the root params into the request context so that the same async-local storage value is visible in: page render, layout render, generateMetadata, server actions, route handlers, `"use cache"` evaluation, and not-found rendering.

4. **Treat the `use cache` case as the high-risk one.** Cache scoping must include the root params in the cache key so that `lang=fr` and `lang=en` do not collide.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.