feat: paginate tweet conversations

This commit is contained in:
2026-07-14 00:29:03 +09:00
parent 1eb2733b38
commit 8e6ff70d81
5 changed files with 204 additions and 39 deletions
+18 -4
View File
@@ -1,9 +1,13 @@
import { createServerFn } from '@tanstack/react-start'
import { searchPageInputSchema, userPageInputSchema } from './inputs'
import { loadUserPage, searchPage } from './post-service'
import type { LoadResult } from './types'
import {
searchPageInputSchema,
threadPageInputSchema,
userPageInputSchema,
} from './inputs'
import { loadThreadPage, loadUserPage, searchPage } from './post-service'
import type { LoadFailure } from './types'
const configFailure = (diagnostic: unknown): LoadResult => {
const configFailure = (diagnostic: unknown): LoadFailure => {
console.error('Bird client configuration failed:', diagnostic)
return {
ok: false,
@@ -39,3 +43,13 @@ export const searchPosts = createServerFn({ method: 'GET' })
return configFailure(error)
}
})
export const loadThreadPosts = createServerFn({ method: 'GET' })
.validator(threadPageInputSchema)
.handler(async ({ data }) => {
try {
return await loadThreadPage(await reader(), data)
} catch (error) {
return configFailure(error)
}
})