Skip to content

test(router-core): regression test for streaming teardown#7531

Closed
birkskyum wants to merge 2 commits into
mainfrom
streaming-regression-test
Closed

test(router-core): regression test for streaming teardown#7531
birkskyum wants to merge 2 commits into
mainfrom
streaming-regression-test

Conversation

@birkskyum
Copy link
Copy Markdown
Member

@birkskyum birkskyum commented Jun 3, 2026

Regression unit tests for streaming teardown

Summary by CodeRabbit

  • Tests
    • Added Vitest coverage for client bootstrap teardown lifecycle, validating teardown occurs only after both hydration and stream-completion, triggers immediately if the document is already complete, and is deferred until DOMContentLoaded when the document is still loading.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fad5c602-74bd-4551-b3f0-c3a56eefd97b

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8930f and dec2619.

📒 Files selected for processing (1)
  • packages/router-core/tests/tsr-script-teardown.test.ts

📝 Walkthrough

Walkthrough

Adds a Vitest test suite that installs the real minified TSR bootstrap and verifies teardown timing: teardown requires both tsr.h() and tsr.e(), occurs immediately if document is already complete, and is deferred until DOMContentLoaded when document is loading.

Changes

Teardown Lifecycle Tests

Layer / File(s) Summary
Teardown test suite and helpers
packages/router-core/tests/tsr-script-teardown.test.ts
Test file with helpers to install the real minified TSR bootstrap and mock document.readyState, plus three tests asserting removal timing of window.$_TSR and window.$R.tsr relative to tsr.h(), tsr.e(), and DOMContentLoaded.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • TanStack/router#7524: Implements the corresponding teardown behavior change in the TSR bootstrap script itself, deferring cleanup until DOMContentLoaded after hydration and stream completion.

Suggested reviewers

  • schiller-manuel

Poem

🐰 I stitched a test to watch the tide,
Waiting for hydrate and stream to collide.
If the DOM's already finished, I hop away soon,
Otherwise I linger till the content's in tune.
Cheers — cleanup hops out with the moon!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: adding a regression test for streaming teardown behavior in router-core, which matches the file addition and PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch streaming-regression-test

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Jun 3, 2026

View your CI Pipeline Execution ↗ for commit 7d8930f

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 8m 43s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 31s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-03 12:11:35 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Bundle Size Benchmarks

  • Commit: dd98daf6dace
  • Measured at: 2026-06-03T12:03:53.574Z
  • Baseline source: history:7fc7c346dc7d
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.25 KiB 0 B (0.00%) 87.12 KiB 273.94 KiB 75.84 KiB █████▁▁▁▁▁▁
react-router.full 90.69 KiB 0 B (0.00%) 90.55 KiB 285.30 KiB 78.83 KiB █████▁▁▁▁▁▁
solid-router.minimal 35.47 KiB 0 B (0.00%) 35.35 KiB 106.24 KiB 32.00 KiB █████▁▁▁▁▁▁
solid-router.full 40.18 KiB 0 B (0.00%) 40.05 KiB 120.43 KiB 36.18 KiB █████▁▁▁▁▁▁
vue-router.minimal 52.97 KiB 0 B (0.00%) 52.84 KiB 150.26 KiB 47.66 KiB █████▁▁▁▁▁▁
vue-router.full 58.60 KiB 0 B (0.00%) 58.47 KiB 167.99 KiB 52.51 KiB █████▁▁▁▁▁▁
react-start.minimal 101.88 KiB 0 B (0.00%) 101.74 KiB 322.26 KiB 88.15 KiB █████▁▁▁▁▁▁
react-start.deferred-hydration 102.61 KiB 0 B (0.00%) 101.76 KiB 323.63 KiB 88.82 KiB █████▁▁▁▁▁▁
react-start.full 105.26 KiB 0 B (0.00%) 105.12 KiB 332.57 KiB 91.09 KiB █████▁▁▁▁▁▁
react-start.rsbuild.minimal 99.58 KiB 0 B (0.00%) 99.41 KiB 316.74 KiB 85.74 KiB █████▁▁▄▄▄▄
react-start.rsbuild.full 102.85 KiB 0 B (0.00%) 102.68 KiB 327.13 KiB 88.45 KiB █████▁▁▄▄▄▄
solid-start.minimal 49.58 KiB 0 B (0.00%) 49.45 KiB 152.31 KiB 43.78 KiB █████▁▁▁▁▁▁
solid-start.deferred-hydration 52.84 KiB 0 B (0.00%) 49.51 KiB 160.35 KiB 46.76 KiB █████▁▁▁▁▁▁
solid-start.full 55.37 KiB 0 B (0.00%) 55.24 KiB 169.24 KiB 48.76 KiB █████▁▁▁▁▁▁

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 3, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: dec2619

@birkskyum birkskyum closed this Jun 3, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 3, 2026

Merging this PR will improve performance by 6.02%

⚡ 1 improved benchmark
✅ 4 untouched benchmarks
⏩ 1 skipped benchmark1

Performance Changes

Benchmark BASE HEAD Efficiency
ssr request loop (vue) 482.3 ms 454.9 ms +6.02%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing streaming-regression-test (dec2619) with main (7fc7c34)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

Sign up for free to 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