Skip to content

feat: enhanced router#372

Merged
lazarv merged 35 commits intomainfrom
feat/router-enhanced
Apr 2, 2026
Merged

feat: enhanced router#372
lazarv merged 35 commits intomainfrom
feat/router-enhanced

Conversation

@lazarv
Copy link
Copy Markdown
Owner

@lazarv lazarv commented Apr 1, 2026

A major evolution of the @lazarv/react-server router, introducing a fully typed routing system, a resource abstraction for data management, scroll restoration, and client-only page support in the file router. This is a foundational change that brings the router closer to feature parity with — and in several areas beyond — framework-level routers like Next.js App Router and TanStack Router.

  • Typed Router — Define routes with full TypeScript type safety for path params, search params, and navigation. Includes path/search param parsers, encoders/decoders, and validator schema support (single or multiple validators). New
    Route, Link, and hook APIs (useParams, useSearchParams, useNavigate) are fully type-aware.
  • Resources — A new @lazarv/react-server/resources export introducing a data resource primitive. Resources can be defined as client-side, server-side, or both, with file-system conventions (.resource.ts) in the file router. Supports
    CRUD-style operations with automatic cache integration.
  • Scroll Restoration — Comprehensive scroll restoration system supporting both auto and manual modes. Tracks scroll positions across navigations with configurable selectors, smooth scrolling, and hash fragment support. Fully
    client-driven with no server round-trips.
  • Client-Only Pages — The file router now supports client-only pages that render entirely on the client without a server component counterpart. Includes proper loading/fallback component support for client-only routes.
  • Virtual Routes — Programmatically define routes in react-server.config.mjs without corresponding files on disk. Enables dynamic route registration from plugins or configuration.
  • Scoped Fallback Routes — Fallback (catch-all) routes can now be scoped to specific route subtrees rather than only matching globally.
  • Functional Search Param UpdaterssetSearchParams now accepts a function (prev) => next for atomic updates based on current state, in addition to the existing object form.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 1, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
react-server-docs eddb587 Apr 02 2026, 08:52 AM

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

⚡ Benchmark Results

PR 5ab3040 main 8be293d
Config 50 connections, 10s/test 50 connections, 10s/test
Benchmark Req/s vs main Avg Latency vs main P99 Latency Throughput
minimal 407 🔴 -67.4% 121.26 ms 🔴 +207.3% 189 ms 2.0 MB/s
small 426 🔴 -68.2% 116.25 ms 🔴 +216.2% 160 ms 2.6 MB/s
medium 196 🔴 -41.5% 252.27 ms 🔴 +70.4% 435 ms 8.7 MB/s
large 24 🔴 -18.0% 1842.06 ms 🔴 +20.2% 3869 ms 8.2 MB/s
deep 320 🔴 -62.8% 155 ms 🔴 +169.7% 206 ms 4.6 MB/s
wide 33 🔴 -17.6% 1373.59 ms 🔴 +16.2% 2797 ms 7.2 MB/s
cached 3157 🔴 -10.5% 15.37 ms 🔴 +12.4% 32 ms 140.1 MB/s
client-min 461 🔴 -50.1% 107.75 ms 🔴 +101.2% 150 ms 2.1 MB/s
client-small 470 🔴 -51.0% 105.72 ms 🔴 +105.8% 149 ms 2.4 MB/s
client-med 362 🔴 -37.8% 137.22 ms 🔴 +61.0% 188 ms 6.8 MB/s
client-large 84 🔴 -6.2% 569.84 ms 🔴 +4.8% 1031 ms 8.8 MB/s
client-deep 442 🔴 -46.1% 111.92 ms 🔴 +85.6% 145 ms 3.3 MB/s
client-wide 140 🔴 -14.4% 350.43 ms 🔴 +16.7% 584 ms 8.2 MB/s
static-json 7212 🟢 +1.3% 6.43 ms ⚪ -0.6% 16 ms 3.0 MB/s
static-js 7058 🟢 +6.9% 6.54 ms 🟢 -7.2% 16 ms 8.4 MB/s
404-miss 4943 🔴 -3.4% 9.59 ms 🔴 +3.8% 19 ms 0.6 MB/s
Legend

🟢 > 1% improvement | 🔴 > 1% regression | ⚪ within noise margin

Benchmarks run on GitHub Actions runners (shared infrastructure) — expect ~5% variance between runs. Consistent directional changes across multiple routes are more meaningful than any single number.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 1, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1862 1 1861 3
View the top 3 failed test(s) by shortest run time
__test__/scroll-restoration.spec.mjs > scroll restoration: multiple back/forward preserves positions
Stack Traces | 40s run time
AssertionError: expected 0 to be greater than 1100
 ❯ __test__/scroll-restoration.spec.mjs:137:25
__test__/apps/mantine.spec.mjs > __test__/apps/mantine.spec.mjs
Stack Traces | 61.4s run time
Error: Hook timed out in 60000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
 ❯ __test__/apps/mantine.spec.mjs:16:10
__test__/router.spec.mjs > router action state
Stack Traces | 138s run time
TimeoutError: page.goto: Timeout 30000ms exceeded.
Call log:
  - navigating to "http://localhost:17955/", waiting until "load"

 ❯ __test__/router.spec.mjs:22:14
__test__/router.spec.mjs > router match
Stack Traces | 141s run time
TimeoutError: page.goto: Timeout 30000ms exceeded.
Call log:
  - navigating to "http://localhost:16424/users/123", waiting until "load"

 ❯ __test__/router.spec.mjs:35:14

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@lazarv lazarv merged commit b7f5f45 into main Apr 2, 2026
730 of 744 checks passed
@lazarv lazarv deleted the feat/router-enhanced branch April 2, 2026 14:43
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