Migrate UserPosts components to TypeScript and Apollo#282
Conversation
|
🚅 Deployed to the quotevote-monorepo-pr-282 environment in profound-optimism
|
✅ Deploy Preview for quotevote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| const pageSize = useMemo(() => { | ||
| const parsed = Number(searchParams?.pageSize) | ||
| return Number.isFinite(parsed) && parsed > 0 ? parsed : 10 | ||
| }, [searchParams?.pageSize]) |
There was a problem hiding this comment.
Bug: Client component cannot receive searchParams as props
The page is marked with "use client" but tries to receive searchParams as a prop. In Next.js App Router, client components do not receive searchParams as props - that pattern only works for server components. The searchParams prop will always be undefined, causing userId to always be empty and the page to always show the "provide a userId" message. Client components need to use the useSearchParams() hook from next/navigation to access query string parameters.
Summary
Testing
Codex Task
Note
Migrates
UserPoststo a typed Apollo-backed component with pagination and states, adds shadcn-style UI primitives and GraphQL query, introduces a test page, and updatesProfileViewto use it.client/src/components/UserPosts/UserPosts.jsxtoUserPosts.tsxusing ApolloGET_USER_POSTSwith typed responses and client-side pagination.userId,pageSize,className.index.tsand removes old JS entry.client/src/graphql/queries/userPosts.tsdefining theGET_USER_POSTSquery and related types.ui/alert,ui/button,ui/card,ui/skeletonand sharedcnutil.client/src/app/test/user-posts/page.tsxfor previewing posts viauserIdand optionalpageSizequery params.client/src/views/Profile/ProfileView.jsxto import and use newUserPosts.Written by Cursor Bugbot for commit 2cbd6c7. This will update automatically on new commits. Configure here.