Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing: Support slug on dir #469

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
17 changes: 17 additions & 0 deletions tests/test/app/routes/directory-slug/[slugOnDir]/[slugOnFile].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useParams } from 'one'
import { Text } from 'react-native'

export async function generateStaticParams() {
return [
{
slugOnDir: 'foo',
slugOnFile: 'bar',
},
]
}

export default function DirectorySlugTest() {
const params = useParams()

return <Text testID="params-json">{JSON.stringify(params)}</Text>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useParams } from 'one'
import { Text } from 'react-native'

export async function generateStaticParams() {
return [
{
slugOnDir: 'foo',
slugOnFile: 'bar',
},
]
}

export default function DirectorySlugTest() {
const params = useParams()

return <Text testID="params-json">{JSON.stringify(params)}</Text>
}
4 changes: 2 additions & 2 deletions tests/test/routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ declare module 'one' {
export namespace OneRouter {
export interface __routes<T extends string = string> extends Record<string, unknown> {
StaticRoutes: `/` | `/(auth-guard)` | `/(auth-guard)/auth-guard` | `/(blog)` | `/(blog)/blog/my-first-post` | `/(marketing)/about` | `/(sub-page-group)` | `/(sub-page-group)/sub-page` | `/(sub-page-group)/sub-page/sub` | `/(sub-page-group)/sub-page/sub2` | `/_sitemap` | `/about` | `/auth-guard` | `/blog/my-first-post` | `/expo-video` | `/hooks` | `/hooks/contents` | `/hooks/contents/page-1` | `/hooks/contents/page-2` | `/loader` | `/loader/other` | `/middleware` | `/not-found/deep/test` | `/not-found/fallback/test` | `/not-found/test` | `/server-data` | `/sheet` | `/spa/spapage` | `/ssr/basic` | `/sub-page` | `/sub-page/sub` | `/sub-page/sub2` | `/web-extensions`
DynamicRoutes: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/subpath/${string}` | `/spa/${OneRouter.SingleRoutePart<T>}` | `/ssr/${OneRouter.SingleRoutePart<T>}` | `/ssr/${string}`
DynamicRouteTemplate: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/subpath/[...subpath]` | `/spa/[spaparams]` | `/ssr/[...rest]` | `/ssr/[param]`
DynamicRoutes: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/directory-slug/${OneRouter.SingleRoutePart<T>}/${OneRouter.SingleRoutePart<T>}` | `/routes/directory-slug/${OneRouter.SingleRoutePart<T>}/subdir/${OneRouter.SingleRoutePart<T>}` | `/routes/subpath/${string}` | `/spa/${OneRouter.SingleRoutePart<T>}` | `/ssr/${OneRouter.SingleRoutePart<T>}` | `/ssr/${string}`
DynamicRouteTemplate: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/directory-slug/[slugOnDir]/[slugOnFile]` | `/routes/directory-slug/[slugOnDir]/subdir/[slugOnFile]` | `/routes/subpath/[...subpath]` | `/spa/[spaparams]` | `/ssr/[...rest]` | `/ssr/[param]`
IsTyped: true
}
}
Expand Down
Loading