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 @@ -60,10 +60,7 @@ export const Route = createFileRoute(
}

if (result.type === 'not-found') {
throw redirect({
to: '/$libraryId/$version/docs/framework/$framework',
params: { libraryId, version, framework },
})
throw notFound()
}

return {
Expand Down
25 changes: 25 additions & 0 deletions tests/docs-route-smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,31 @@ type SmokeCase = {

const baseUrl = process.env.TANSTACK_DOCS_SMOKE_BASE_URL

test(
'missing Start documents return 404 without redirecting to the framework index',
{
skip: baseUrl
? false
: 'Set TANSTACK_DOCS_SMOKE_BASE_URL to run docs route smoke tests',
},
async () => {
assert.ok(baseUrl)

for (const framework of ['react', 'solid']) {
const path = `/start/latest/docs/framework/${framework}/missing-docs-smoke-test`
const response: Response = await fetch(new URL(path, baseUrl), {
redirect: 'manual',
signal: AbortSignal.timeout(30_000),
})
const html = await response.text()

assert.equal(response.status, 404, `${path} should return 404 directly`)
assert.equal(response.headers.get('location'), null)
assert.match(html, /404 Not Found/)
}
},
)

test(
'docs legacy and canonical routes complete for every public library',
{
Expand Down
Loading