Skip to content

Resolve route admission before opaque data preparation - #12

Merged
KidkArolis merged 5 commits into
masterfrom
codex/guards-before-prepare
Aug 15, 2026
Merged

Resolve route admission before opaque data preparation#12
KidkArolis merged 5 commits into
masterfrom
codex/guards-before-prepare

Conversation

@KidkArolis

@KidkArolis KidkArolis commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Cold loads and speculative prefetches could begin resolver and data work before an application applied synchronous admission policy. That unnecessarily warmed protected route data and left authentication boundaries exposed to preparation races.

Routes now support synchronous parent-first guard(route) checks before resolver loading, preparation, prefetching, or rendering. Returning a destination redirects; returning undefined admits the segment and continues through its children. React Space Router depends on space-router@^2.1.0 and reuses its canonical getRouteRedirect() helper, so cold preparation follows the same guard-before-redirect ordering as normal navigation.

Preparation also no longer assumes that every data layer represents work as [definition, args]. Routes declare flat arrays of opaque requests, either statically or through one outer queries(ctx) resolver. The router never invokes values inside that array, including function-valued requests, and forwards each one unchanged to data.prepare(request) or data.prefetch(request). Argument binding and validation stay entirely with the adapter.

Validation: npm test passes all 102 tests against the published space-router@2.1.0 package.

@KidkArolis KidkArolis changed the title Prepare guarded routes without coupling data layers Resolve route admission before opaque data preparation Aug 15, 2026
@KidkArolis
KidkArolis merged commit 0088c76 into master Aug 15, 2026
6 checks passed
@KidkArolis
KidkArolis deleted the codex/guards-before-prepare branch August 15, 2026 13:31
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.

1 participant