Skip to content

Conversation

alexjamesgodfrey
Copy link
Contributor

@alexjamesgodfrey alexjamesgodfrey commented Sep 25, 2025

Since the RC, serverOnly and clientOnly no longer exist, and we use createServerOnlyFn and createClientOnlyFn. I updated the docs to reflect that.

Summary by CodeRabbit

  • New Features

    • Introduced createServerOnlyFn and createClientOnlyFn helpers for environment-bound execution.
  • Documentation

    • Updated guides, examples, import examples, error messages, and tree-shaking notes to use the new helper names.
  • Refactor

    • Renamed public environment helpers (serverOnly → createServerOnlyFn, clientOnly → createClientOnlyFn) and removed the old exports from the public API.

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Renames environment utility functions and their references in documentation and exports from serverOnly/clientOnly to createServerOnlyFn/createClientOnlyFn, updating imports, examples, error messages, and notes about removed old exports in @tanstack/react-start. No behavioral changes.

Changes

Cohort / File(s) Summary
Docs: React environment utilities
docs/start/framework/react/environment-functions.md
Replaced all occurrences of serverOnly/clientOnly with createServerOnlyFn/createClientOnlyFn; updated import examples, usage snippets, runtime/error messages, tree-shaking/conditional-replacement text, and notes about old exports being removed from @tanstack/react-start.
Public exports (API surface)
@tanstack/react-start (export names)
Renamed exported identifiers: removed serverOnly/clientOnly and introduced createServerOnlyFn/createClientOnlyFn as the public exports (documentation and examples updated accordingly).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

"A twitch of whiskers, a soft little spin,
I rename the tunnels but keep the den within.
createServerOnlyFn curls where roots run deep,
createClientOnlyFn dances in daylight's sweep.
Hop on my back — the change is done, nibble a carrot, then sleep." 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately summarizes the main change by stating that the environment-functions.md documentation is updated with the correct function names, directly reflecting the renaming of serverOnly and clientOnly to createServerOnlyFn and createClientOnlyFn in this PR.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc27565 and f93f872.

📒 Files selected for processing (1)
  • docs/start/framework/react/environment-functions.md (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)

Files:

  • docs/start/framework/react/environment-functions.md
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/start/framework/react/environment-functions.md
🔇 Additional comments (1)
docs/start/framework/react/environment-functions.md (1)

88-112: Nice alignment with renamed helpers

The doc now matches the current createServerOnlyFn/createClientOnlyFn API, including the sample imports and error messages. Thanks for keeping the guidance in sync with the code.


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.

@github-actions github-actions bot added the documentation Everything documentation related label Sep 25, 2025
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed7004b and 2042703.

📒 Files selected for processing (1)
  • docs/start/framework/react/environment-functions.md (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)

Files:

  • docs/start/framework/react/environment-functions.md
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/start/framework/react/environment-functions.md

@nlynzaad
Copy link
Contributor

Thanks for this. Can you please check the comment made by code rabbit. Seems like it is relevant

@nlynzaad nlynzaad changed the title Update environment-functions.md with correct function names Docs(Start): Update environment-functions.md with correct function names Sep 25, 2025
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: 0

🧹 Nitpick comments (1)
docs/start/framework/react/environment-functions.md (1)

123-123: Tighten the tree-shaking sentence

The duplicate “functions” makes this line a bit clunky. Dropping the second instance keeps the sentence clear.

-On the server, functions created using `createClientOnlyFn()` functions are replaced with a function that throws an `Error` on the server.
+On the server, functions created using `createClientOnlyFn()` are replaced with a function that throws an `Error`.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2042703 and cc27565.

📒 Files selected for processing (1)
  • docs/start/framework/react/environment-functions.md (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)

Files:

  • docs/start/framework/react/environment-functions.md
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/start/framework/react/environment-functions.md

@alexjamesgodfrey
Copy link
Contributor Author

Thanks for this. Can you please check the comment made by code rabbit. Seems like it is relevant

Thx Nico, should be all set now! Thanks for updating the pr title as well, I'll use that format in the future.

Copy link

nx-cloud bot commented Sep 25, 2025

View your CI Pipeline Execution ↗ for commit bf9d44c

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

☁️ Nx Cloud last updated this comment at 2025-09-25 22:34:06 UTC

Copy link

pkg-pr-new bot commented Sep 25, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5236

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5236

@tanstack/eslint-plugin-router

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

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5236

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5236

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5236

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5236

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5236

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5236

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5236

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5236

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5236

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5236

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5236

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5236

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5236

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5236

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5236

commit: bf9d44c

@nlynzaad
Copy link
Contributor

Thanks for working on this

@nlynzaad nlynzaad merged commit 903b17b into TanStack:main Sep 25, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Everything documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants