mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
45b72eade5
* fix: stabilize instrumentation state and hydration E2E tests Move Cloudflare instrumentation example state from module-level variables to globalThis so startup and request paths share one owner across different module instances. Add waitForHydration() helper to Pages Router E2E tests to eliminate flaky button-click assertions that raced against React hydration. * fix: honor the `as` parameter in router.push/replace The `as` parameter in push() and replace() was silently ignored (prefixed as _as) in both the useRouter() hook and the Router singleton. This broke masked URLs and legacy dynamic-route flows. Extract resolveNavigationTarget() helper that uses `as` when provided, falling back to resolveUrl(url) otherwise. Apply to all four call sites: useRouter().push, useRouter().replace, Router.push, Router.replace. * fix: address PR review feedback - Add doc comment to resolveNavigationTarget explaining the url/as simplification vs Next.js's two-value approach - Extract waitForHydration to shared tests/e2e/helpers.ts - Add pathname assertion to verify router.pathname stays as route pattern (/posts/[id]) after as-based navigation * fix: remove pathname assertion that tests unimplemented behavior router.pathname currently returns the resolved path after client-side navigation, not the route pattern. The correct behavior (returning /posts/[id] instead of /posts/42) requires the two-value url/as approach tracked in #462.
App Router on Cloudflare Workers
A minimal example of a Next.js App Router application running on Cloudflare Workers via vinext.
Demonstrates server components, client components, dynamic routes, and API route handlers.
Running Locally
- Install dependencies:
pnpm install
- Start the dev server:
pnpm dev
- Build for production:
pnpm build
- Preview the production build:
pnpm preview