Feat/bookmark search filter#656
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
@OmanshiRaj is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
More reviews will be available in 8 minutes and 51 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
⭐ Star Required
Hi @OmanshiRaj! Thank you for your contribution to DoubtDesk.
Before we can complete the review and merge this pull request, please star the DoubtDesk repository.
Once you have starred the repository, please drop a comment here saying "done" and we will proceed with reviewing your PR. Thank you!
| {charCount === 0 && ( | ||
| <span className="text-slate-500">Min {minLength} · Max {maxLength} characters</span> | ||
| <span className={`font-medium tabular-nums ${ | ||
| charCount > maxLength | ||
| ? "text-red-500 dark:text-red-400" | ||
| : charCount >= maxLength * 0.9 | ||
| ? "text-amber-500 dark:text-amber-400" | ||
| : "text-slate-500 dark:text-slate-400" | ||
| }`}> | ||
| {charCount}/{maxLength} | ||
| </span> | ||
| )} |
There was a problem hiding this comment.
Suggestion: This conditional block adds a second character counter when the input is empty, so the UI shows duplicate 0/500 counters at the same time. It also contains unreachable style branches because charCount === 0 makes the charCount > maxLength and charCount >= maxLength * 0.9 checks impossible. Remove the duplicate counter or merge it with the existing right-side counter logic. [incorrect condition logic]
Severity Level: Major ⚠️
- ⚠️ Duplicate counters in AskDoubt compose textarea header.
- ⚠️ Unreachable branches complicate character limit color logic.Steps of Reproduction ✅
1. Open a page that renders the AskDoubt modal, for example
`src/app/rooms/[id]/page.tsx:997-999`, which conditionally renders `<AskDoubt
isOpen={isAskModalOpen} ... />` when the local `isAskModalOpen` state is true.
2. In the running app, trigger the AskDoubt modal from that rooms page (e.g., via the "Ask
Doubt" control wired to `isAskModalOpen`), so that the component at
`src/components/AskDoubt.tsx` mounts with an empty `content` string.
3. With `content` still empty, `charCount` is `0`, so in `src/components/AskDoubt.tsx` at
lines 507–517 the `{charCount === 0 && (...)}` block renders the new inline counter while
the right-side counter at lines 519–521 (`{charCount} / {maxLength}`) also renders,
producing two visible `0 / maxLength` counters simultaneously.
4. Inspect the conditional styling inside the new empty-state counter at lines 509–513
(`charCount > maxLength ? ... : charCount >= maxLength * 0.9 ? ... : ...`): because
`charCount === 0` on this path, both `charCount > maxLength` and `charCount >= maxLength *
0.9` are always false, so the red and amber branches are never reachable, confirming the
unreachable-condition issue and the redundant counter.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** src/components/AskDoubt.tsx
**Line:** 507:517
**Comment:**
*Incorrect Condition Logic: This conditional block adds a second character counter when the input is empty, so the UI shows duplicate `0/500` counters at the same time. It also contains unreachable style branches because `charCount === 0` makes the `charCount > maxLength` and `charCount >= maxLength * 0.9` checks impossible. Remove the duplicate counter or merge it with the existing right-side counter logic.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| document.execCommand("copy"); | ||
| document.body.removeChild(textArea); |
There was a problem hiding this comment.
Suggestion: The fallback copy path treats document.execCommand("copy") as always successful, but this API can return false without throwing. In that case, users will still see a success toast even though nothing was copied. Check the boolean return value and show an error when the copy command fails. [logic error]
Severity Level: Major ⚠️
- ❌ Copy-link menu can report success on clipboard failure.
- ⚠️ Users may think doubts were share-copied when not.Steps of Reproduction ✅
1. Use any page that renders DoubtCard, such as
`src/components/InfiniteDoubtFeed.tsx:149-151` or `src/app/public-rooms/page.tsx:379-380`,
where `<DoubtCard ... />` is created for each doubt.
2. Run the app in an environment where the modern clipboard path is unavailable (so
`navigator.clipboard` is undefined or `window.isSecureContext` is false), causing
`handleShare` in `src/components/DoubtCard.tsx:23-44` to take the fallback branch that
creates a temporary textarea and calls `document.execCommand("copy")` at PR hunk line 215.
3. In a browser or Jest test, stub `document.execCommand("copy")` to return `false`
without throwing (matching the DOM API contract that it returns a boolean), then click the
"Share doubt" button and choose the "Copy link" menu item wired to `onClick={handleShare}`
at `src/components/DoubtCard.tsx:215-218`.
4. Observe that even though `document.execCommand("copy")` returned `false` and no text
was actually copied to the clipboard, execution continues to the success path and
`toast.success(SHARE_MESSAGES.COPY_SUCCESS)` at `src/components/DoubtCard.tsx:39` still
fires, so users are told the link was copied when it was not.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** src/components/DoubtCard.tsx
**Line:** 215:216
**Comment:**
*Logic Error: The fallback copy path treats `document.execCommand("copy")` as always successful, but this API can return `false` without throwing. In that case, users will still see a success toast even though nothing was copied. Check the boolean return value and show an error when the copy command fails.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
CodeAnt AI finished reviewing your PR. |
knoxiboy
left a comment
There was a problem hiding this comment.
@OmanshiRaj look into the problem mentioned by coderabbit & codeant and resolve the problem also look into the failing CI tests and fix them as well
User description
CLOSES #639
Added a client-side search bar to the Bookmarks page (src/app/bookmarks/page.tsx) that filters bookmarked doubts in real-time by subject or content as the user types. The search input only renders when bookmarks exist, includes a clear (×) button to reset the query, and shows a friendly "No Results Found" empty state with a Clear Search button when no bookmarks match — keeping it distinct from the existing "No Bookmarks Yet" empty state. No API changes were needed since filtering happens entirely on the already-fetched data, making it instant with zero extra network requests.
CodeAnt-AI Description
Add bookmark search and improve sharing, image labels, and question length feedback
What Changed
Impact
✅ Faster bookmark lookup✅ Fewer copy-link failures✅ Clearer screen reader labels💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.