Skip to content

fix(react-start-client): preserve idle hydration deadlines - #8272

Open
LadyBluenotes wants to merge 1 commit into
mainfrom
fix/react-idle-hydration-deadline
Open

fix(react-start-client): preserve idle hydration deadlines#8272
LadyBluenotes wants to merge 1 commit into
mainfrom
fix/react-idle-hydration-deadline

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Sep 6, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Inline idle() calls create new strategy objects on each render, which restarted pending hydration. Keep the existing schedule when its timeout is unchanged, while preserving timeout and strategy changes, custom setup overrides, and unmount cleanup.

✅ 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

  • Bug Fixes

    • Improved idle hydration reliability during parent component re-renders.
    • Pending hydration now remains scheduled when the idle timeout is unchanged.
    • Hydration is correctly rescheduled when the timeout or strategy changes.
    • Pending idle hydration is cancelled when a component is unmounted.
  • Documentation

    • Clarified how recreating idle hydration settings affects scheduling and replacement behavior.

@nx-cloud

nx-cloud Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 81fa70d

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

☁️ Nx Cloud last updated this comment at 2026-09-06 18:53:50 UTC

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

9 package(s) bumped directly, 16 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/history 1.162.1 → 1.162.2 Changeset
@tanstack/nitro-v2-vite-plugin 1.155.0 → 1.155.1 Changeset
@tanstack/react-router 1.170.32 → 1.170.33 Changeset
@tanstack/react-start-client 1.168.30 → 1.168.31 Changeset
@tanstack/router-core 1.171.27 → 1.171.28 Changeset
@tanstack/solid-router 1.170.30 → 1.170.31 Changeset
@tanstack/start-client-core 1.170.27 → 1.170.28 Changeset
@tanstack/start-plugin-core 1.171.39 → 1.171.40 Changeset
@tanstack/vue-router 1.170.29 → 1.170.30 Changeset
@tanstack/react-start 1.168.49 → 1.168.50 Dependent
@tanstack/react-start-rsc 0.1.48 → 0.1.49 Dependent
@tanstack/react-start-server 1.167.37 → 1.167.38 Dependent
@tanstack/router-cli 1.167.33 → 1.167.34 Dependent
@tanstack/router-generator 1.167.33 → 1.167.34 Dependent
@tanstack/router-plugin 1.168.35 → 1.168.36 Dependent
@tanstack/router-vite-plugin 1.167.35 → 1.167.36 Dependent
@tanstack/solid-start 1.168.47 → 1.168.48 Dependent
@tanstack/solid-start-client 1.168.29 → 1.168.30 Dependent
@tanstack/solid-start-server 1.167.36 → 1.167.37 Dependent
@tanstack/start-server-core 1.169.31 → 1.169.32 Dependent
@tanstack/start-static-server-functions 1.167.32 → 1.167.33 Dependent
@tanstack/start-storage-context 1.167.29 → 1.167.30 Dependent
@tanstack/vue-start 1.168.46 → 1.168.47 Dependent
@tanstack/vue-start-client 1.167.32 → 1.167.33 Dependent
@tanstack/vue-start-server 1.167.36 → 1.167.37 Dependent

@coderabbitai

coderabbitai Bot commented Sep 6, 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: b15d8d06-3f53-4800-b496-62cf599597ed

📥 Commits

Reviewing files that changed from the base of the PR and between 216c0c4 and 81fa70d.

📒 Files selected for processing (6)
  • .changeset/idle-hydration-deadline.md
  • docs/start/framework/react/guide/deferred-hydration.md
  • packages/react-start-client/src/GenericHydrate.tsx
  • packages/react-start-client/src/tests/Hydrate.test.tsx
  • packages/start-client-core/src/hydration/idle.ts
  • packages/start-client-core/src/hydration/types.ts

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


📝 Walkthrough

Walkthrough

Idle hydration now preserves pending work when its timeout remains unchanged. It reschedules when the timeout or strategy changes, cancels work on unmount, and documents and tests these behaviors.

Changes

Idle hydration scheduling

Layer / File(s) Summary
Idle strategy identity contract
packages/start-client-core/src/hydration/types.ts, packages/start-client-core/src/hydration/idle.ts
The idle setup function now exposes its normalized timeout through _i. The hydration strategy type supports this optional property.
React hydration scheduling integration
packages/react-start-client/src/GenericHydrate.tsx
React hydration tracks the latest strategy and uses a stable strategy key and strategy type to control effect execution.
Scheduling behavior validation and documentation
packages/react-start-client/src/tests/Hydrate.test.tsx, docs/start/framework/react/guide/deferred-hydration.md, .changeset/idle-hydration-deadline.md
Tests cover deadline preservation, timeout changes, custom setup replacement, and unmount cancellation. Documentation and release metadata describe the behavior.

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

Merge Risk: ⚪ Minimal · up to 81fa7

React idle hydration now retains pending work across rerenders when the timeout is unchanged while preserving rescheduling and cleanup behavior. The covered behavior is ready to merge.

Sequence Diagram(s)

sequenceDiagram
  participant GenericHydrate
  participant HydrationStrategy
  participant idleSetup
  participant BrowserScheduler
  GenericHydrate->>HydrationStrategy: Read current strategy and stable key
  GenericHydrate->>idleSetup: Invoke _s setup
  idleSetup->>BrowserScheduler: Schedule idle hydration
  BrowserScheduler-->>GenericHydrate: Run hydration callback
  GenericHydrate->>GenericHydrate: Cancel setup on replacement or unmount
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description check ✅ Passed The description follows the repository template. It explains the change, completes all checklist items, and documents the release impact and changeset.
Title check ✅ Passed The title clearly and concisely describes the primary change: preserving idle hydration deadlines in react-start-client.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (2 skipped: 2 unsupported.)

  • 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 fix/react-idle-hydration-deadline

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.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 81fa70d

@codspeed-hq

codspeed-hq Bot commented Sep 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 180 untouched benchmarks


Comparing fix/react-idle-hydration-deadline (81fa70d) with main (216c0c4)

Open in CodSpeed

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