()
| 12 | }) |
| 13 | |
| 14 | function PostsComponent() { |
| 15 | const postsQuery = useQuery(() => postsQueryOptions()) |
| 16 | |
| 17 | return ( |
| 18 | <div class="p-2 flex gap-2"> |
| 19 | <ul class="list-disc pl-4"> |
| 20 | <Suspense fallback={<div>Loading posts...</div>}> |
| 21 | <For |
| 22 | each={[ |
| 23 | ...(postsQuery.data || []), |
| 24 | { id: 'i-do-not-exist', title: 'Non-existent Post' }, |
| 25 | ]} |
| 26 | > |
| 27 | {(post) => ( |
| 28 | <li class="whitespace-nowrap"> |
| 29 | <Link |
| 30 | to="/posts/$postId" |
| 31 | params={{ |
| 32 | postId: post.id, |
| 33 | }} |
| 34 | class="block py-1 text-blue-800 hover:text-blue-600" |
| 35 | activeProps={{ class: 'text-black font-bold' }} |
| 36 | > |
| 37 | <div>{post.title.substring(0, 20)}</div> |
| 38 | </Link> |
| 39 | </li> |
| 40 | )} |
| 41 | </For> |
| 42 | </Suspense> |
| 43 | </ul> |
| 44 | <hr /> |
| 45 | <Outlet /> |
| 46 | </div> |
| 47 | ) |
| 48 | } |
nothing calls this directly
no test coverage detected