Skip to content
Source
Sign inSign up
TanStack/router

fix(router-core): add support for handling any kind of empty _splat consistently #5510

Mergedpaul-sachs(GitHub profile, opens in a new tab)merged 13 commits intomain fromrefs/pull/5510/headmerged by nlynzaad(GitHub profile, opens in a new tab)

Showing 10 changed files with 146 additions and 0 deletions (loading 8).

x
0 of 10 viewed, 10 left
91 additions and 0 deletionspackages/react-router/tests/link.test.tsxModified
View file
@@ -12,6 +12,7 @@
} from '@testing-library/react'
​
import { z } from 'zod'
+import { trailingSlashOptions } from '@tanstack/router-core'
import {
Link,
Outlet,
@@ -5549,6 +5550,96 @@
+describe('splat routes with empty splat', () => {
+ test.each(Object.values(trailingSlashOptions))(
+ 'should handle empty _splat parameter with trailingSlash: %s',
+ async (trailingSlash) => {
+ const tail = trailingSlash === 'always' ? '/' : ''
+​
+ const rootRoute = createRootRoute()
+ const indexRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: '/',
+ component: () => {
+ return (
+ <>