feat: 增强路由类型安全与数据预加载
- 为路由器上下文添加类型约束以确保类型安全 - 在根路由中添加查询客户端上下文类型并使用带上下文的根路由创建函数 - 启用加载器以预先获取待办事项列表数据
This commit is contained in:
@@ -6,9 +6,9 @@ import { orpc } from '@/orpc'
|
||||
|
||||
export const Route = createFileRoute('/todos')({
|
||||
component: Todos,
|
||||
// loader: async ({ context }) => {
|
||||
// await context.queryClient.prefetchQuery(orpc.todo.list.queryOptions())
|
||||
// },
|
||||
loader: async ({ context }) => {
|
||||
await context.queryClient.prefetchQuery(orpc.todo.list.queryOptions())
|
||||
},
|
||||
})
|
||||
|
||||
function Todos() {
|
||||
|
||||
Reference in New Issue
Block a user