Skip to content

test(react-router): cover pending and not-found context - #8243

Merged
Sheraff merged 1 commit into
fix/skip-descendant-lifecycle-boundariesfrom
codex/8128-context-regressions
Sep 5, 2026
Merged

test(react-router): cover pending and not-found context#8243
Sheraff merged 1 commit into
fix/skip-descendant-lifecycle-boundariesfrom
codex/8128-context-regressions

Conversation

@Sheraff

@SheraffSheraff commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

🎯 Changes

Add six regression tests for context availability during pending navigation and not-found handling:

  • A pending child reads completed ancestor context while its beforeLoad and loader wait.
  • Overlapping invalidations retain the latest displayed context, publish the next generation on completion, and resist rollback from obsolete work.
  • A root beforeLoad throwing not-found exposes only completed root data and does not run its loader.
  • A child context throwing not-found preserves ancestor context in client and server rendering.
  • An automatic not-found destination follows its configured pending UI and publishes fresh owner context after beforeLoad completes.

The SSR assertions check each output independently. These cases consolidate the recovered investigation probes and cover existing behavior. Stacked on #8165.

Validation: the full react-router unit, type, and lint targets passed locally (1,047 unit tests passed; one skipped).

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Added coverage for pending-route context during navigation and loading.
    • Added coverage ensuring not-found routes preserve the appropriate inherited context in client-side and server-rendered scenarios.
    • Added coverage for automatic not-found navigation while route context is still pending.
    • Added tests for overlapping navigations and ensuring the latest context is retained.

@coderabbitai

coderabbitaiBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 12465c8d-e821-4ba6-a144-d3756cca4971

📥 Commits

Reviewing files that changed from the base of the PR and between a383ad5 and 40bfa36.

📒 Files selected for processing (3)
  • packages/react-router/tests/not-found-pending-context.test.tsx
  • packages/react-router/tests/not-found-route-context.test.tsx
  • packages/react-router/tests/pending-route-context.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds React Router tests for context behavior during pending child loading, overlapping invalidations, automatic not-found navigation, client not-found responses, SSR rendering, and root beforeLoad not-found handling.

Changes

Router context handling

Layer / File(s)Summary
Pending route context and invalidation
packages/react-router/tests/pending-route-context.test.tsx
Controlled-promise tests verify settled ancestor context in pending UI, delayed child context availability, and latest-generation context after overlapping invalidations.
Not-found route context
packages/react-router/tests/not-found-route-context.test.tsx, packages/react-router/tests/not-found-pending-context.test.tsx
Tests verify inherited context for client and SSR not-found responses, root beforeLoad behavior, pending automatic not-found UI, and resolved owner context.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk:⚪ Minimal · up to 40bfa

This change adds regression coverage for pending navigation and not-found context behavior without changing production behavior. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Title check✅ PassedThe title clearly and concisely identifies the main change: React Router tests for pending and not-found context behavior.
Description check✅ PassedThe description follows the required template, explains the six regression tests, records validation results, and states the release impact. The AI-assistance understanding item remains unchecked, but…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/8128-context-regressions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connectorBot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

ReviewStatusCommitReview trigger
📝 Code ReviewCompleted2026-09-04T23:02:05.568246Za0f4fddPR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nx-cloud

nx-cloudBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 40bfa36

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded14m 34sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded2m 13sView ↗

☁️ Nx Cloud last updated this comment at 2026-09-05 21:51:11 UTC

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:a0f4fdd46e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

function ChildNotFoundComponent() {
const context = parentRoute.useRouteContext()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise the child match's context in the not-found boundary

When the /parent/child context callback throws, parentRoute.useRouteContext() reads the separate, already-successful parent match, so both client and SSR assertions pass even if the failing child match loses all inherited context. This leaves the stated regression untested because a real child notFoundComponent can call childRoute.useRouteContext(); use that hook here and assert only the inherited fields so the test actually covers the failed match.

Useful? React with 👍 / 👎.

@pkg-pr-new

pkg-pr-newBot commented Sep 4, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@8243

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@8243

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8243

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@8243

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@8243

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@8243

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@8243

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@8243

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@8243

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@8243

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@8243

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@8243

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@8243

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@8243

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@8243

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@8243

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@8243

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@8243

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@8243

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@8243

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@8243

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@8243

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@8243

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8243

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@8243

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@8243

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@8243

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@8243

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8243

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@8243

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@8243

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@8243

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@8243

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@8243

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8243

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@8243

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8243

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8243

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@8243

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@8243

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@8243

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@8243

commit: 40bfa36

@github-actions

github-actionsBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

6 package(s) bumped directly, 18 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/nitro-v2-vite-plugin1.155.0 → 1.155.1Changeset
@tanstack/react-router1.170.32 → 1.170.33Changeset
@tanstack/router-core1.171.27 → 1.171.28Changeset
@tanstack/solid-router1.170.30 → 1.170.31Changeset
@tanstack/start-plugin-core1.171.39 → 1.171.40Changeset
@tanstack/vue-router1.170.29 → 1.170.30Changeset
@tanstack/react-start1.168.49 → 1.168.50Dependent
@tanstack/react-start-client1.168.30 → 1.168.31Dependent
@tanstack/react-start-rsc0.1.48 → 0.1.49Dependent
@tanstack/react-start-server1.167.37 → 1.167.38Dependent
@tanstack/router-cli1.167.33 → 1.167.34Dependent
@tanstack/router-generator1.167.33 → 1.167.34Dependent
@tanstack/router-plugin1.168.35 → 1.168.36Dependent
@tanstack/router-vite-plugin1.167.35 → 1.167.36Dependent
@tanstack/solid-start1.168.47 → 1.168.48Dependent
@tanstack/solid-start-client1.168.29 → 1.168.30Dependent
@tanstack/solid-start-server1.167.36 → 1.167.37Dependent
@tanstack/start-client-core1.170.27 → 1.170.28Dependent
@tanstack/start-server-core1.169.31 → 1.169.32Dependent
@tanstack/start-static-server-functions1.167.32 → 1.167.33Dependent
@tanstack/start-storage-context1.167.29 → 1.167.30Dependent
@tanstack/vue-start1.168.46 → 1.168.47Dependent
@tanstack/vue-start-client1.167.32 → 1.167.33Dependent
@tanstack/vue-start-server1.167.36 → 1.167.37Dependent

@github-actions

github-actionsBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: b9434ea448ff
  • Measured at: 2026-09-05T21:34:39.914Z
  • Baseline source: history:0497caeef3ff
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

ScenarioCurrent (gzip)Initial (gzip)RawBrotliTrend
react-router.minimal83.8 KiB
+57 B
83.7 KiB
+54 B
262.2 KiB
+191 B
73.0 KiB
+18 B
▄▄▁▃▃▃▃▄▄▄▂█
react-router.full87.3 KiB
+66 B
87.2 KiB
+65 B
273.9 KiB
+186 B
76.0 KiB
-58 B
▄▄▁▃▃▃▃▃▃▃▃█
solid-router.minimal33.2 KiB
+58 B
33.1 KiB
+59 B
96.3 KiB
+189 B
29.9 KiB
+53 B
▄▄▁▃▄▄▄▄▄▄▄█
solid-router.full38.0 KiB
+38 B
37.9 KiB
+37 B
110.9 KiB
+189 B
34.2 KiB
-43 B
▄▃▁▂▃▃▃▃▃▃▅█
vue-router.minimal49.5 KiB
+51 B
49.4 KiB
+50 B
138.3 KiB
+189 B
44.7 KiB
+68 B
▄▄▁▂▃▃▃▃▃▃▄█
vue-router.full55.1 KiB
+52 B
55.0 KiB
+52 B
156.6 KiB
+189 B
49.6 KiB
-26 B
▅▅▁▃▃▃▃▃▃▃▄█
react-start.minimal96.7 KiB
+72 B
96.6 KiB
+72 B
304.5 KiB
+210 B
83.9 KiB
+143 B
▄▄▁▃▃▃▃▃▃▃▃█
react-start.query-integration104.1 KiB
+39 B
103.9 KiB
+39 B
331.0 KiB
+207 B
90.3 KiB
+207 B
▄▄▁▃▃▃▃▃▃▃▅█
react-start.deferred-hydration97.5 KiB
+53 B
96.6 KiB
+57 B
305.9 KiB
+216 B
84.5 KiB
+46 B
▃▄▁▂▃▃▂▃▃▃▄█
react-start.full99.9 KiB
+64 B
99.8 KiB
+64 B
314.2 KiB
+208 B
86.6 KiB
+194 B
▃▃▁▃▃▃▃▃▃▃▄█
react-start.rsbuild.minimal100.0 KiB
+67 B
99.9 KiB
+67 B
314.8 KiB
+212 B
86.3 KiB
+128 B
▄▄▁▂▂▂▁▂▂▂▄█
react-start.rsbuild.minimal-iife100.4 KiB
+66 B
100.3 KiB
+66 B
315.8 KiB
+212 B
86.7 KiB
+92 B
▄▄▁▂▂▂▁▂▂▂▄█
react-start.rsbuild.full103.4 KiB
+69 B
103.2 KiB
+69 B
324.9 KiB
+212 B
89.1 KiB
+106 B
▄▄▁▂▂▂▁▂▂▂▃█
solid-start.minimal46.0 KiB
+63 B
45.9 KiB
+64 B
137.4 KiB
+211 B
40.9 KiB
-93 B
▃▃▁▃▃▃▃▃▃▃▃█
solid-start.deferred-hydration49.1 KiB
+54 B
46.0 KiB
+57 B
144.9 KiB
+211 B
43.7 KiB
-31 B
▃▄▁▃▄▄▄▄▄▄▄█
solid-start.full51.1 KiB
+55 B
51.0 KiB
+57 B
152.8 KiB
+211 B
45.3 KiB
+7 B
▄▄▁▂▃▃▃▃▃▃▃█
vue-start.minimal65.7 KiB
+52 B
65.5 KiB
+50 B
189.2 KiB
+205 B
58.4 KiB
-27 B
▅▅▁▂▃▃▃▃▃▃▃█
vue-start.full69.5 KiB
+47 B
69.4 KiB
+46 B
201.5 KiB
+211 B
61.8 KiB
+10 B
▅▆▁▃▃▃▃▃▃▃▄█

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@codspeed-hq

codspeed-hqBot commented Sep 4, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 8.65%

⚠️Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 5 improved benchmarks
❌ 7 (👁 2) regressed benchmarks
✅ 168 untouched benchmarks
⏩ 48 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths unmatched (react)421 KB1,547.5 KB-72.8%
Memorymem client unique-location-churn (vue)424 KB450.4 KB-5.87%
Memorymem client navigation-churn (vue)1.6 MB1.7 MB-5.2%
Memorymem client preload-churn (vue)759 KB792.9 KB-4.28%
Memorymem server error-paths unmatched (vue)572.7 KB592.2 KB-3.29%
Memorymem server error-paths not-found (vue)751.3 KB533.7 KB+40.77%
Memorymem server error-paths not-found (react)472.6 KB431.4 KB+9.55%
Memorymem client interrupted-navigations (vue)381.6 KB357.4 KB+6.78%
Memorymem client navigation-churn (solid)687.9 KB651.9 KB+5.53%
Memorymem server peak-large-page (solid)1.1 MB1.1 MB+4.82%
👁Memorymem server aborted-requests (vue)1 MB1 MB-4.11%
👁Memorymem server peak-large-page (vue)1 MB1.2 MB-13.98%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing codex/8128-context-regressions (40bfa36) with fix/skip-descendant-lifecycle-boundaries (a383ad5)

Open in CodSpeed

Footnotes

  1. 48 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Sheraff
Sheraffforce-pushed the codex/8128-context-regressions branch 2 times, most recently from d8ccbba to a8d549bCompareSeptember 4, 2026 23:55
nx-cloud[bot]

This comment was marked as outdated.

@Sheraff
Sheraffforce-pushed the codex/8128-context-regressions branch from a8d549b to 96affcaCompareSeptember 5, 2026 11:56

@nx-cloudnx-cloudBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud has identified a possible root cause for your failed CI:

We classified this failure as an environment issue rather than a code change because the failing task (tanstack-vue-start-e2e-basic:test:e2e--rsbuild-ssr) belongs to a Vue Start e2e project that was not touched by this PR, which only adds React Router unit tests. The root cause is a port conflict (EADDRINUSE :::37965) caused by a stale process in the CI runner, unrelated to any of our changes — a clean rerun should resolve it.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@Sheraff
Sheraffforce-pushed the codex/8128-context-regressions branch from 96affca to 40bfa36CompareSeptember 5, 2026 21:28
@Sheraff
Sheraff merged commit 07b3bc9 into mainSep 5, 2026
28 of 34 checks passed
@Sheraff
Sheraff deleted the codex/8128-context-regressions branch September 5, 2026 22:00
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff