Skip to content

fix vite preview streaming#6828

Open
huseeiin wants to merge 3 commits intoTanStack:mainfrom
huseeiin:fix-vite-preview-streaming
Open

fix vite preview streaming#6828
huseeiin wants to merge 3 commits intoTanStack:mainfrom
huseeiin:fix-vite-preview-streaming

Conversation

@huseeiin
Copy link
Contributor

@huseeiin huseeiin commented Mar 5, 2026

now streaming works in vite preview

Summary by CodeRabbit

  • Chores

    • Modified preview server to disable content compression only for HTML responses instead of for all responses.
    • Ensures the Content-Encoding header is set to identity when serving HTML, narrowing prior global behavior.
    • Reduces scope of header changes to HTML content, limiting unintended effects on non-HTML responses.
  • Chores

    • Added a changeset documenting a minor release and noting the streaming fix for preview.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

Set the Content-Encoding response header to "identity" only for downstream HTML responses in the preview server middleware, applied after obtaining the downstream response and before remaining response handling.

Changes

Cohort / File(s) Summary
Preview Server Middleware
packages/start-plugin-core/src/preview-server-plugin/plugin.ts
Add conditional to set Content-Encoding: identity only when downstream response Content-Type indicates HTML; applied after reading webRes and before further response processing.
Changeset
.changeset/thick-lines-follow.md
Add new changeset documenting a minor release for @tanstack/start-plugin-core with note "fix streaming in vite preview".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudge a header, soft and spry,
For HTML breezes passing by.
No squeezes now, just gentle stream—
The preview bounces like a dream. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix vite preview streaming' directly aligns with the main change: adding a conditional to handle Content-Encoding for HTML responses in the preview server plugin to fix streaming behavior in vite preview.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

Migrating from UI to YAML configuration.

Use the @coderabbitai configuration command in a PR comment to get a dump of all your UI settings in YAML format. You can then edit this YAML file and upload it to the root of your repository to configure CodeRabbit programmatically.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Bundle Size Benchmarks

  • Commit: 215cab47e8b9
  • Measured at: 2026-03-15T11:23:55.355Z
  • Baseline source: history:215cab47e8b9
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.13 KiB 0 B (0.00%) 274.22 KiB 75.76 KiB ▂▂▂▁███████
react-router.full 90.13 KiB 0 B (0.00%) 284.48 KiB 78.44 KiB ▂▂▂▁███████
solid-router.minimal 36.48 KiB 0 B (0.00%) 109.43 KiB 32.81 KiB ▁▁▁▁███████
solid-router.full 40.80 KiB 0 B (0.00%) 122.40 KiB 36.66 KiB ▁▁▁▁███████
vue-router.minimal 52.35 KiB 0 B (0.00%) 149.47 KiB 47.02 KiB ▁▁▁▁███████
vue-router.full 57.14 KiB 0 B (0.00%) 164.98 KiB 51.26 KiB ▁▁▁▁███████
react-start.minimal 99.71 KiB 0 B (0.00%) 313.37 KiB 86.21 KiB ▂▂▂▁███████
react-start.full 103.02 KiB 0 B (0.00%) 323.10 KiB 89.08 KiB ▂▂▂▁███████
solid-start.minimal 48.79 KiB 0 B (0.00%) 147.02 KiB 43.13 KiB ▁▁▁▁███████
solid-start.full 54.26 KiB 0 B (0.00%) 162.88 KiB 47.81 KiB ▁▁▁▁███████

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@nx-cloud
Copy link

nx-cloud bot commented Mar 5, 2026

View your CI Pipeline Execution ↗ for commit 5ca69c1

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

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 5, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 5ca69c1

let serverBuild: any = null

server.middlewares.use(async (req, res, next) => {
res.setHeader('content-encoding', 'identity')
Copy link
Contributor

Choose a reason for hiding this comment

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

is this only required for solid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this only required for solid?

i don't think so. its for all streaming frameworks

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 5, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing huseeiin:fix-vite-preview-streaming (5ca69c1) with main (215cab4)

Open in CodSpeed

@huseeiin huseeiin marked this pull request as draft March 14, 2026 17:08
@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: 5ca69c1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@tanstack/start-plugin-core Minor
@tanstack/react-start Patch
@tanstack/solid-start Patch
@tanstack/vue-start Patch
@tanstack/start-static-server-functions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@huseeiin huseeiin marked this pull request as ready for review March 15, 2026 10:14
@huseeiin huseeiin force-pushed the fix-vite-preview-streaming branch from 66c6d1e to 5ca69c1 Compare March 15, 2026 11:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/thick-lines-follow.md:
- Line 2: The changeset incorrectly marks '@tanstack/start-plugin-core' as
minor; update the entry in .changeset/thick-lines-follow.md to use a patch bump
instead of minor by replacing "minor" with "patch" for the
'@tanstack/start-plugin-core' line so the changeset reflects this fix-level
release.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4707b51e-9cf1-4b2b-a539-2b64ac75d22b

📥 Commits

Reviewing files that changed from the base of the PR and between 66c6d1e and 5ca69c1.

📒 Files selected for processing (1)
  • .changeset/thick-lines-follow.md

@@ -0,0 +1,5 @@
---
'@tanstack/start-plugin-core': minor
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use a patch bump for this bug-fix changeset.

Line 2 currently marks @tanstack/start-plugin-core as minor, but this PR is scoped as a fix. This should be patch to keep release semantics accurate.

Suggested change
-'@tanstack/start-plugin-core': minor
+'@tanstack/start-plugin-core': patch
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'@tanstack/start-plugin-core': minor
'@tanstack/start-plugin-core': patch
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/thick-lines-follow.md at line 2, The changeset incorrectly marks
'@tanstack/start-plugin-core' as minor; update the entry in
.changeset/thick-lines-follow.md to use a patch bump instead of minor by
replacing "minor" with "patch" for the '@tanstack/start-plugin-core' line so the
changeset reflects this fix-level release.

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.

2 participants