Skip to content

Conversation

@tannerlinsley
Copy link
Collaborator

@tannerlinsley tannerlinsley commented Oct 20, 2025

Add JSDoc annotations to Link, createLink, useNavigate, and Navigate to improve developer experience and link to documentation.


Open in Cursor Open in Web

Summary by CodeRabbit

  • New Features
    • Introduced a new Link component for navigation with built-in preload capabilities, active/inactive state handling, hover delays, and transition support
    • Added createLink utility function to build custom, strongly-typed link components
    • Introduced a Navigate component enabling declarative programmatic navigation with automatic effect-based triggering

Co-authored-by: tannerlinsley <tannerlinsley@gmail.com>
@cursor
Copy link

cursor bot commented Oct 20, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR adds three new exported entities to react-router: a createLink factory function and a Link component in link.tsx, and a Navigate component in useNavigate.tsx.

Changes

Cohort / File(s) Summary
Link Components
packages/react-router/src/link.tsx
Added createLink factory function that creates link components with support for generic type parameters and ref forwarding. Added default Link component with JSDoc documentation covering navigation props, preload behavior, active/inactive prop merging, transitions, and hover delay options.
Navigation Components
packages/react-router/src/useNavigate.tsx
Added Navigate component with generic signature and comprehensive type parameters (TFrom, TTo, TMaskFrom, TMaskTo) that triggers navigation via useEffect when props change. Added corresponding JSDoc documentation. No changes to existing useNavigate hook.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 New links to hop and routes to trace,

Factory functions set the pace,

Navigate with clearer sight,

React Router feels so right! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/add-essential-jsdoc-to-public-api-a048

📜 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 521e737 and 309db13.

📒 Files selected for processing (2)
  • packages/react-router/src/link.tsx (2 hunks)
  • packages/react-router/src/useNavigate.tsx (2 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Oct 20, 2025

View your CI Pipeline Execution ↗ for commit 309db13

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

☁️ Nx Cloud last updated this comment at 2025-10-20 19:57:03 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 20, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: 309db13

@tannerlinsley tannerlinsley marked this pull request as ready for review October 20, 2025 21:41
@tannerlinsley tannerlinsley merged commit 8568185 into main Oct 20, 2025
6 checks passed
@tannerlinsley tannerlinsley deleted the cursor/add-essential-jsdoc-to-public-api-a048 branch October 20, 2025 21:41
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.

3 participants