WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/react-router/src/ClientOnly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ export interface ClientOnlyProps {
* )
* ```
*/
/**
* Render children only after client hydration; otherwise render `fallback`.
* Useful for components that require browser-only APIs.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/clientOnlyComponent
*/
export function ClientOnly({ children, fallback = null }: ClientOnlyProps) {
return useHydrated() ? (
<React.Fragment>{children}</React.Fragment>
Expand Down Expand Up @@ -60,9 +55,6 @@ export function ClientOnly({ children, fallback = null }: ClientOnlyProps) {
* ```
* @returns True if the JS has been hydrated already, false otherwise.
*/
/**
* Return a boolean indicating whether client hydration has occurred.
*/
export function useHydrated(): boolean {
return React.useSyncExternalStore(
subscribe,
Expand Down
4 changes: 0 additions & 4 deletions packages/react-router/src/HeadContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@ export const useTags = () => {
)
}

/**
* @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
* It should be rendered in the `<head>` of your document.
*/
/**
* Render route-managed head tags (title, meta, links, styles, head scripts).
* Place inside the document head of your app shell.
Expand Down
12 changes: 0 additions & 12 deletions packages/react-router/src/Matches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ declare module '@tanstack/router-core' {
}
}

/**
* Internal component that renders the router's active match tree with
* suspense, error, and not-found boundaries. Rendered by `RouterProvider`.
*/
/**
* Internal component that renders the router's active match tree with
* suspense, error, and not-found boundaries. Rendered by `RouterProvider`.
Expand Down Expand Up @@ -263,10 +259,6 @@ export function useMatches<
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook
*/
/**
* Read the full array of active route matches or select a derived subset
* from the parent boundary up to (but not including) the current match.
*/
export function useParentMatches<
TRouter extends AnyRouter = RegisteredRouter,
TSelected = unknown,
Expand All @@ -289,10 +281,6 @@ export function useParentMatches<
} as any)
}

/**
* Read the array of active route matches that are children of the current
* match (or selected parent) in the match tree.
*/
/**
* Read the array of active route matches that are children of the current
* match (or selected parent) in the match tree.
Expand Down
9 changes: 0 additions & 9 deletions packages/react-router/src/RouterProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import type {
RouterOptions,
} from '@tanstack/router-core'

/**
* Low-level provider that places the router into React context and optionally
* updates router options from props. Most apps should use `RouterProvider`.
*/
/**
* Low-level provider that places the router into React context and optionally
* updates router options from props. Most apps should use `RouterProvider`.
Expand Down Expand Up @@ -61,11 +57,6 @@ export function RouterContextProvider<
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
*/
/**
* Top-level component that renders the active route matches and provides the
* router to the React tree via context. Accepts the same options as
* `createRouter` via props to update the router instance.
*/
export function RouterProvider<
TRouter extends AnyRouter = RegisteredRouter,
TDehydrated extends Record<string, any> = Record<string, any>,
Expand Down
4 changes: 0 additions & 4 deletions packages/react-router/src/Scripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { useRouterState } from './useRouterState'
import { useRouter } from './useRouter'
import type { RouterManagedTag } from '@tanstack/router-core'

/**
* Render body script tags collected from route matches and SSR manifests.
* Should be placed near the end of the document body.
*/
/**
* Render body script tags collected from route matches and SSR manifests.
* Should be placed near the end of the document body.
Expand Down
5 changes: 0 additions & 5 deletions packages/react-router/src/awaited.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export type AwaitOptions<T> = {
promise: Promise<T>
}

/** Suspend until a deferred promise resolves/rejects and return its data. */
/** Suspend until a deferred promise resolves or rejects and return its data. */
export function useAwaited<T>({
promise: _promise,
Expand All @@ -25,10 +24,6 @@ export function useAwaited<T>({
return [promise[TSR_DEFERRED_PROMISE].data, promise]
}

/**
* Component that suspends on a deferred promise and renders its child with
* the resolved value. Optionally provides a Suspense fallback.
*/
/**
* Component that suspends on a deferred promise and renders its child with
* the resolved value. Optionally provides a Suspense fallback.
Expand Down
59 changes: 0 additions & 59 deletions packages/react-router/src/fileRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,6 @@ import type { UseRouteContextRoute } from './useRouteContext'
* @returns A function that accepts Route options and returns a Route instance.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
*/
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still has duplicated jsdocs

* Creates a file-based Route factory for a given path.
*
* Used by TanStack Router's file-based routing to associate a file with a
* route. The returned function accepts standard route options. In normal usage
* the `path` string is inserted and maintained by the `tsr` generator.
*
* @param path File path literal for the route (usually auto-generated).
* @returns A function that accepts Route options and returns a Route instance.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
*/
/**
* Creates a file-based Route factory for a given path.
* Used by file-based routing to associate a file with a route. The returned
* function accepts standard route options; the path is typically auto-managed
* by the generator.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
*/
export function createFileRoute<
TFilePath extends keyof FileRoutesByPath,
TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],
Expand Down Expand Up @@ -177,16 +159,6 @@ export class FileRoute<
}
}

/**
@deprecated It's recommended not to split loaders into separate files.
Instead, place the loader function in the the main route file, inside the
`createFileRoute('/path/to/file)(options)` options.
*/
/**
@deprecated It's recommended not to split loaders into separate files.
Instead, place the loader function in the the main route file, inside the
`createFileRoute('/path/to/file)(options)` options.
*/
/**
@deprecated It's recommended not to split loaders into separate files.
Instead, place the loader function in the main route file via `createFileRoute`.
Expand Down Expand Up @@ -303,22 +275,6 @@ export class LazyRoute<TRoute extends AnyRoute> {
* @returns A function that accepts lazy route options and returns a `LazyRoute`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction
*/
/**
* Creates a lazily-configurable code-based route stub by ID.
*
* Use this for code-splitting with code-based routes. The returned function
* accepts only non-critical route options like `component`, `pendingComponent`,
* `errorComponent`, and `notFoundComponent` which are applied when the route
* is matched.
*
* @param id Route ID string literal to associate with the lazy route.
* @returns A function that accepts lazy route options and returns a `LazyRoute`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction
*/
/**
* Create a lazily-configurable code-based route stub by ID.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction
*/
export function createLazyRoute<
TRouter extends AnyRouter = RegisteredRouter,
TId extends string = string,
Expand All @@ -343,21 +299,6 @@ export function createLazyRoute<
* @returns A function that accepts lazy route options and returns a `LazyRoute`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction
*/
/**
* Creates a lazily-configurable file-based route stub by file path.
*
* Use this for code-splitting with file-based routes (eg. `.lazy.tsx` files).
* The returned function accepts only non-critical route options like
* `component`, `pendingComponent`, `errorComponent`, and `notFoundComponent`.
*
* @param id File path literal for the route file.
* @returns A function that accepts lazy route options and returns a `LazyRoute`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction
*/
/**
* Create a lazily-configurable file-based route stub by file path.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction
*/
export function createLazyFileRoute<
TFilePath extends keyof FileRoutesByPath,
TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],
Expand Down
5 changes: 0 additions & 5 deletions packages/react-router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ declare module '@tanstack/router-core' {
* @returns A Router instance to be provided to `RouterProvider`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
*/
/**
* Create a new React router instance from `RouterOptions`.
* Pass the resulting router to `RouterProvider`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
*/
export const createRouter: CreateRouterFn = (options) => {
return new Router(options)
}
Expand Down
4 changes: 0 additions & 4 deletions packages/react-router/src/useLoaderData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ export type UseLoaderDataRoute<out TId> = <
* @returns The loader data (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
*/
/**
* Read and select the current route's loader data with type‑safety.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
*/
export function useLoaderData<
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string | undefined = undefined,
Expand Down
4 changes: 0 additions & 4 deletions packages/react-router/src/useLoaderDeps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ export type UseLoaderDepsRoute<out TId> = <
* @returns The loader deps (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook
*/
/**
* Read and select the current route's loader dependencies object.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook
*/
export function useLoaderDeps<
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string | undefined = undefined,
Expand Down
5 changes: 0 additions & 5 deletions packages/react-router/src/useLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ export type UseLocationResult<
* @returns The current location (or selected value).
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
*/
/**
* Read the current location from the router state with optional selection.
* Useful for subscribing to just the pieces of location you care about.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
*/
export function useLocation<
TRouter extends AnyRouter = RegisteredRouter,
TSelected = unknown,
Expand Down
4 changes: 0 additions & 4 deletions packages/react-router/src/useParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export type UseParamsRoute<out TFrom> = <
* @returns The params object (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useParamsHook
*/
/**
* Access the current route's path parameters with type-safety.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useParamsHook
*/
export function useParams<
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string | undefined = undefined,
Expand Down
5 changes: 0 additions & 5 deletions packages/react-router/src/useRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ import type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'
* @returns The registered router instance.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook
*/
/**
* Access the current TanStack Router instance from React context.
* Must be used within a `RouterProvider`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook
*/
export function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
warn?: boolean
}): TRouter {
Expand Down
5 changes: 0 additions & 5 deletions packages/react-router/src/useRouterState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ export type UseRouterStateResult<
* @returns The selected router state (or the full state by default).
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook
*/
/**
* Subscribe to the router's state store with optional selection and
* structural sharing for render optimization.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook
*/
export function useRouterState<
TRouter extends AnyRouter = RegisteredRouter,
TSelected = unknown,
Expand Down
4 changes: 0 additions & 4 deletions packages/react-router/src/useSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export type UseSearchRoute<out TFrom> = <
* @returns The search object (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useSearchHook
*/
/**
* Read and select the current route's search parameters with type-safety.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useSearchHook
*/
export function useSearch<
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string | undefined = undefined,
Expand Down
13 changes: 0 additions & 13 deletions packages/router-core/src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from './new-process-route-tree'
import type { LRUCache } from './lru-cache'

/** Join path segments, cleaning duplicate slashes between parts. */
/** Join path segments, cleaning duplicate slashes between parts. */
export function joinPaths(paths: Array<string | undefined>) {
return cleanPath(
Expand All @@ -20,27 +19,23 @@ export function joinPaths(paths: Array<string | undefined>) {
)
}

/** Remove repeated slashes from a path string. */
/** Remove repeated slashes from a path string. */
export function cleanPath(path: string) {
// remove double slashes
return path.replace(/\/{2,}/g, '/')
}

/** Trim leading slashes (except preserving root '/'). */
/** Trim leading slashes (except preserving root '/'). */
export function trimPathLeft(path: string) {
return path === '/' ? path : path.replace(/^\/{1,}/, '')
}

/** Trim trailing slashes (except preserving root '/'). */
/** Trim trailing slashes (except preserving root '/'). */
export function trimPathRight(path: string) {
const len = path.length
return len > 1 && path[len - 1] === '/' ? path.replace(/\/{1,}$/, '') : path
}

/** Trim both leading and trailing slashes. */
/** Trim both leading and trailing slashes. */
export function trimPath(path: string) {
return trimPathRight(trimPathLeft(path))
Expand All @@ -58,10 +53,6 @@ export function removeTrailingSlash(value: string, basepath: string): string {
// see the usage in the isActive under useLinkProps
// /sample/path1 = /sample/path1/
// /sample/path1/some <> /sample/path1
/**
* Compare two pathnames for exact equality after normalizing trailing slashes
* relative to the provided `basepath`.
*/
/**
* Compare two pathnames for exact equality after normalizing trailing slashes
* relative to the provided `basepath`.
Expand Down Expand Up @@ -241,10 +232,6 @@ function encodeParam(
* - Encodes params safely (configurable allowed characters)
* - Supports `{-$optional}` segments, `{prefix{$id}suffix}` and `{$}` wildcards
*/
/**
* Interpolate params and wildcards into a route path template.
* Encodes safely and supports optional params and custom decode char maps.
*/
export function interpolatePath({
path,
params,
Expand Down
4 changes: 0 additions & 4 deletions packages/router-core/src/qss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* // Expected output: "token=foo&key=value"
* ```
*/
/** Encode a plain object into a URL query string using URLSearchParams. */
export function encode(
obj: Record<string, any>,
stringify: (value: any) => string = String,
Expand All @@ -47,15 +46,13 @@ export function encode(
* // Example input: toValue("123")
* // Expected output: 123
*/
/** Convert a string into a primitive boolean/number when possible. */
function toValue(str: unknown) {
if (!str) return ''

if (str === 'false') return false
if (str === 'true') return true
return +str * 0 === 0 && +str + '' === str ? +str : str
}

/**
* Decodes a query string into an object.
* @param str - The query string to decode.
Expand All @@ -64,7 +61,6 @@ function toValue(str: unknown) {
* // Example input: decode("token=foo&key=value")
* // Expected output: { "token": "foo", "key": "value" }
*/
/** Decode a URL query string into an object with basic type coercion. */
export function decode(str: any): any {
const searchParams = new URLSearchParams(str)

Expand Down
4 changes: 0 additions & 4 deletions packages/router-core/src/redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ export type ResolvedRedirect<
* @returns A Response augmented with router navigation options.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
*/
/**
* Create a redirect Response understood by TanStack Router.
* Use inside loaders/beforeLoad or server handlers to trigger navigation.
*/
export function redirect<
TRouter extends AnyRouter = RegisteredRouter,
const TTo extends string | undefined = '.',
Expand Down
Loading
Loading