Conversation
…t for headers init
WalkthroughAdjusted header initialization in redirect logic to call new Headers(opts.headers) instead of providing an empty object fallback. No public API signatures or control flow were changed. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
View your CI Pipeline Execution ↗ for commit a989703
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/router-core/src/redirect.ts (2)
75-75: Guard against accidental null with nullish coalescingUsing
??preserves the “no extra allocation” goal while safely handling unexpectednullvalues that might slip in fromparseRedirect(obj)or external JS callers.- const headers = new Headers(opts.headers) + const headers = new Headers(opts.headers ?? undefined)
76-78: Usehasfor clarity when checking Location header
headers.has('Location')is more idiomatic than comparingget(...) === null.- if (opts.href && headers.get('Location') === null) { + if (opts.href && !headers.has('Location')) { headers.set('Location', opts.href) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/router-core/src/redirect.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (1)
packages/router-core/src/redirect.ts (1)
75-83: Approve: passing undefined for headers is safeRipgrep search found no occurrences of
headers: null, confirming no callers rely onnull. The?? undefinedguard preserves behavior and avoids an extra allocation.
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
…t for headers init (TanStack#5076) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Streamlined header initialization in redirect handling to rely on default behavior when no headers are provided. * Improves consistency and reduces implicit assumptions in header processing without altering existing behavior. * **Chores** * Minor internal cleanup to align with standard header handling patterns. No functional changes are expected for end-users; redirects and related headers continue to behave as before. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Refactor
Chores
No functional changes are expected for end-users; redirects and related headers continue to behave as before.