@tanstack/react-router 1.130.9 → 1.130.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -447,6 +447,15 @@ The \`Redirect\` object accepts/contains the following properties:
447
447
  - Optional
448
448
  - The HTTP headers to use when redirecting.
449
449
 
450
+ ### Navigation Properties
451
+
452
+ Since \`Redirect\` extends \`NavigateOptions\`, it also supports navigation properties:
453
+
454
+ - **\`to\`**: Use for internal application routes (e.g., \`/dashboard\`, \`../profile\`)
455
+ - **\`href\`**: Use for external URLs (e.g., \`https://example.com\`, \`https://authprovider.com\`)
456
+
457
+ > **Important**: For external URLs, always use the \`href\` property instead of \`to\`. The \`to\` property is designed for internal navigation within your application.
458
+
450
459
  # Register type
451
460
 
452
461
  This type is used to register a route tree with a router instance. Doing so unlocks the full type safety of TanStack Router, including top-level exports from the \`@tanstack/react-router\` package.
@@ -2993,7 +3002,7 @@ The \`redirect\` function accepts a single argument, the \`options\` to determin
2993
3002
  import { redirect } from '@tanstack/react-router'
2994
3003
 
2995
3004
  const route = createRoute({
2996
- // throwing a redirect object
3005
+ // throwing an internal redirect object using 'to' property
2997
3006
  loader: () => {
2998
3007
  if (!user) {
2999
3008
  throw redirect({
@@ -3001,6 +3010,14 @@ const route = createRoute({
3001
3010
  })
3002
3011
  }
3003
3012
  },
3013
+ // throwing an external redirect object using 'href' property
3014
+ loader: () => {
3015
+ if (needsExternalAuth) {
3016
+ throw redirect({
3017
+ href: 'https://authprovider.com/login',
3018
+ })
3019
+ }
3020
+ },
3004
3021
  // or forcing \`redirect\` to throw itself
3005
3022
  loader: () => {
3006
3023
  if (!user) {