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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
useLinkProps,
useLoaderData,
useLoaderDeps,
useLayoutEffect,
useLocation,
useMatch,
useMatchRoute,
Expand All @@ -42,7 +41,6 @@ import {
useRouter,
useRouterState,
useSearch,
useStableCallback,
useTags,
} from '@tanstack/react-router'

Expand All @@ -69,11 +67,9 @@ function RootComponent() {
const location = useLocation()
const canGoBack = useCanGoBack()
const navigate = useNavigate()
const stableCallback = useStableCallback(() => {})
const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
const tags = useTags()

useLayoutEffect(() => {}, [])
useBlocker({
shouldBlockFn: () => false,
disabled: true,
Expand All @@ -95,7 +91,6 @@ function RootComponent() {
useMatch,
useLoaderDeps,
useLoaderData,
useLayoutEffect,
useBlocker,
useNavigate,
useParams,
Expand All @@ -105,7 +100,6 @@ function RootComponent() {
useRouterState,
useLocation,
useCanGoBack,
useStableCallback,
useElementScrollRestoration,
useTags,
Await,
Expand Down Expand Up @@ -147,7 +141,6 @@ function RootComponent() {
void routerState
void location
void canGoBack
stableCallback()
void navigate
void scrollEntry
void tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
useLinkProps,
useLoaderData,
useLoaderDeps,
useLayoutEffect,
useLocation,
useMatch,
useMatchRoute,
Expand All @@ -42,7 +41,6 @@ import {
useRouter,
useRouterState,
useSearch,
useStableCallback,
useTags,
} from '@tanstack/react-router'
import {
Expand Down Expand Up @@ -92,12 +90,10 @@ function RootComponent() {
const location = useLocation()
const canGoBack = useCanGoBack()
const navigate = useNavigate()
const stableCallback = useStableCallback(() => {})
const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
const tags = useTags()
const invokeServerFn = useServerFn(helloServerFn)

useLayoutEffect(() => {}, [])
useBlocker({
shouldBlockFn: () => false,
disabled: true,
Expand All @@ -120,7 +116,6 @@ function RootComponent() {
useMatch,
useLoaderDeps,
useLoaderData,
useLayoutEffect,
useBlocker,
useNavigate,
useParams,
Expand All @@ -130,7 +125,6 @@ function RootComponent() {
useRouterState,
useLocation,
useCanGoBack,
useStableCallback,
useElementScrollRestoration,
useTags,
Await,
Expand Down Expand Up @@ -173,7 +167,6 @@ function RootComponent() {
void routerState
void location
void canGoBack
stableCallback()
void navigate
void scrollEntry
void tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
useChildMatches,
useElementScrollRestoration,
useHydrated,
useLayoutEffect,
useLinkProps,
useLoaderData,
useLoaderDeps,
Expand Down Expand Up @@ -71,7 +70,6 @@ function RootComponent() {
const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
const tags = useTags()

useLayoutEffect(() => {})
useBlocker({
shouldBlockFn: () => false,
disabled: true,
Expand All @@ -93,7 +91,6 @@ function RootComponent() {
useMatch,
useLoaderDeps,
useLoaderData,
useLayoutEffect,
useBlocker,
useNavigate,
useParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
useChildMatches,
useElementScrollRestoration,
useHydrated,
useLayoutEffect,
useLinkProps,
useLoaderData,
useLoaderDeps,
Expand Down Expand Up @@ -104,7 +103,6 @@ function RootComponent() {
const tags = useTags()
const invokeServerFn = useServerFn(helloServerFn)

useLayoutEffect(() => {})
useBlocker({
shouldBlockFn: () => false,
disabled: true,
Expand All @@ -127,7 +125,6 @@ function RootComponent() {
useMatch,
useLoaderDeps,
useLoaderData,
useLayoutEffect,
useBlocker,
useNavigate,
useParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
useCanGoBack,
useChildMatches,
useElementScrollRestoration,
useLayoutEffect,
useLinkProps,
useLoaderData,
useLoaderDeps,
Expand Down Expand Up @@ -70,7 +69,6 @@ function RootComponent() {
const navigate = useNavigate()
const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
const tags = useTags()
const layoutEffectRunner = useLayoutEffect(() => {})

useBlocker({
shouldBlockFn: () => false,
Expand All @@ -92,7 +90,6 @@ function RootComponent() {
useMatch,
useLoaderDeps,
useLoaderData,
useLayoutEffect,
useBlocker,
useNavigate,
useParams,
Expand Down Expand Up @@ -148,7 +145,6 @@ function RootComponent() {
void navigate
void scrollEntry
void tags()
void layoutEffectRunner
void routeMatchResult.value

return (
Expand Down
16 changes: 1 addition & 15 deletions packages/react-router/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export {
defer,
TSR_DEFERRED_PROMISE,
isMatch,
joinPaths,
cleanPath,
Expand All @@ -10,7 +9,6 @@ export {
resolvePath,
interpolatePath,
rootRouteId,
defaultSerializeError,
defaultParseSearch,
defaultStringifySearch,
parseSearchWith,
Expand Down Expand Up @@ -236,7 +234,6 @@ export {

export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'

export { matchContext } from './matchContext'
export { Match, Outlet } from './Match'

export { useMatch } from './useMatch'
Expand Down Expand Up @@ -274,13 +271,7 @@ export type {

export { createRouter, Router } from './router'

export {
componentTypes,
lazyFn,
SearchParamError,
PathParamError,
getInitialRouterState,
} from '@tanstack/router-core'
export { lazyFn, SearchParamError } from '@tanstack/router-core'

export { RouterProvider, RouterContextProvider } from './RouterProvider'
export type { RouterProps } from './RouterProvider'
Expand All @@ -304,11 +295,6 @@ export { useRouterState } from './useRouterState'
export { useLocation } from './useLocation'
export { useCanGoBack } from './useCanGoBack'

export {
useLayoutEffect, // SSR
useStableCallback,
} from './utils'

export { CatchNotFound, DefaultGlobalNotFound } from './not-found'
export { notFound, isNotFound } from '@tanstack/router-core'
export type { NotFoundError } from '@tanstack/router-core'
Expand Down
11 changes: 1 addition & 10 deletions packages/router-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export type {
RequiredToOptions,
} from './link'

export { componentTypes } from './load-matches'

export type {
RouteToPath,
TrailingSlashOptionByRouter,
Expand Down Expand Up @@ -264,15 +262,13 @@ export type { SearchSerializer, SearchParser } from './searchParams'
export type { OptionalStructuralSharing } from './structuralSharing'

export {
last,
functionalUpdate,
replaceEqualDeep,
isPlainObject,
isPlainArray,
deepEqual,
createControlledPromise,
isModuleNotFoundError,
decodePath,
DEFAULT_PROTOCOL_ALLOWLIST,
escapeHtml,
isDangerousProtocol,
Expand Down Expand Up @@ -440,7 +436,6 @@ export { defaultSerovalPlugins } from './ssr/serializer/seroval-plugins'

export {
RawStream,
RawStreamSSRPlugin,
createRawStreamRPCPlugin,
createRawStreamDeserializePlugin,
} from './ssr/serializer/RawStream'
Expand All @@ -450,9 +445,5 @@ export type {
RawStreamOptions,
} from './ssr/serializer/RawStream'

export {
composeRewrites,
executeRewriteInput,
executeRewriteOutput,
} from './rewrite'
export { composeRewrites, executeRewriteInput } from './rewrite'
export type { LocationRewrite, LocationRewriteFunction } from './router'
2 changes: 1 addition & 1 deletion packages/router-core/src/ssr/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { mergeHeaders, headersInitToObject } from './headers'
export { mergeHeaders } from './headers'
export { json } from './json'
export type { JsonResponse } from './json'
export { hydrate } from './ssr-client'
Expand Down
12 changes: 0 additions & 12 deletions packages/router-core/src/ssr/headers.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import { splitSetCookieString } from 'cookie-es'
import type { OutgoingHttpHeaders } from 'node:http2'

// A utility function to turn HeadersInit into an object
export function headersInitToObject(
headers: HeadersInit,
): Record<keyof OutgoingHttpHeaders, string> {
const obj: Record<keyof OutgoingHttpHeaders, string> = {}
const headersInstance = new Headers(headers)
for (const [key, value] of headersInstance.entries()) {
obj[key] = value
}
return obj
}

export type AnyHeaders =
| Headers
| HeadersInit
Expand Down
13 changes: 1 addition & 12 deletions packages/solid-router/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export {
defer,
TSR_DEFERRED_PROMISE,
isMatch,
joinPaths,
cleanPath,
Expand All @@ -10,7 +9,6 @@ export {
resolvePath,
interpolatePath,
rootRouteId,
defaultSerializeError,
defaultParseSearch,
defaultStringifySearch,
parseSearchWith,
Expand Down Expand Up @@ -244,7 +242,6 @@ export {

export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'

export { matchContext } from './matchContext'
export { Match, Outlet } from './Match'

export { useMatch } from './useMatch'
Expand Down Expand Up @@ -280,13 +277,7 @@ export type {

export { createRouter, Router } from './router'

export {
componentTypes,
lazyFn,
SearchParamError,
PathParamError,
getInitialRouterState,
} from '@tanstack/router-core'
export { lazyFn, SearchParamError } from '@tanstack/router-core'

export { RouterProvider, RouterContextProvider } from './RouterProvider'
export type { RouterProps } from './RouterProvider'
Expand All @@ -310,8 +301,6 @@ export { useRouterState } from './useRouterState'
export { useLocation } from './useLocation'
export { useCanGoBack } from './useCanGoBack'

export { useLayoutEffect } from './utils'

export { CatchNotFound, DefaultGlobalNotFound } from './not-found'
export { notFound, isNotFound } from '@tanstack/router-core'
export type { NotFoundError } from '@tanstack/router-core'
Expand Down
3 changes: 0 additions & 3 deletions packages/solid-router/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import * as Solid from 'solid-js'

export const useLayoutEffect =
typeof window !== 'undefined' ? Solid.createRenderEffect : Solid.createEffect

export const usePrevious = (fn: () => boolean) => {
return Solid.createMemo(
(
Expand Down
Loading
Loading