fix(recruiter): restore applicant list when clearing search#1406
Conversation
|
Hi @YAXH64, thanks for contributing to InternHack! 🎉 I have automatically:
Our workflows will now analyze your changes to classify:
Tip Ensure your PR description references the issue it resolves (e.g. Happy coding! 🚀 |
📝 WalkthroughWalkthroughEnhanced ChangesConfirmation Modal for Application Advancement
Sequence DiagramsequenceDiagram
participant User
participant ApplicationsList
participant ConfirmDialog
participant Advance Handler
User->>ApplicationsList: Click "Advance" button
ApplicationsList->>ApplicationsList: Set pendingAdvanceApp
ApplicationsList->>ConfirmDialog: Render modal (opens)
User->>ConfirmDialog: Click confirm
ConfirmDialog->>ApplicationsList: Trigger onConfirm callback
ApplicationsList->>Advance Handler: Call handleAdvance(appId)
Advance Handler->>ApplicationsList: Mutation completes
ApplicationsList->>ApplicationsList: Clear pendingAdvanceApp
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@client/src/module/recruiter/applications/ApplicationsList.tsx`:
- Around line 97-106: The confirmation message can render an empty <strong> when
pendingAdvanceApp.student?.name is missing; update the JSX in ApplicationsList
(the interpolation inside the <strong> in the pendingAdvanceApp block) to use a
safe fallback (e.g., pendingAdvanceApp.student?.name ?? "this candidate" or
"Unnamed candidate") so the UI always shows a readable name, keeping the rest of
the message unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cb128818-2d7f-406f-90ce-c9a0953a732c
📒 Files selected for processing (2)
client/src/components/ui/ConfirmDialog.tsxclient/src/module/recruiter/applications/ApplicationsList.tsx
| {pendingAdvanceApp && ( | ||
| <div className="space-y-4"> | ||
| <p className="text-sm text-stone-600 dark:text-stone-400"> | ||
| Are you sure you want to advance <strong className="font-semibold text-stone-900 dark:text-white">{pendingAdvanceApp.student?.name}</strong> to the next hiring stage? | ||
| </p> | ||
| <p className="text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/20 p-2.5 rounded-lg border border-amber-200/30 dark:border-amber-900/30 leading-normal"> | ||
| Warning: Advancing this candidate will update their hiring stage and create a new round submission. | ||
| </p> | ||
| </div> | ||
| )} |
There was a problem hiding this comment.
Provide a fallback for undefined candidate name.
If pendingAdvanceApp.student.name is undefined or empty, the confirmation message will have an empty <strong> tag, degrading readability.
🛡️ Proposed fix to add a name fallback
<p className="text-sm text-stone-600 dark:text-stone-400">
- Are you sure you want to advance <strong className="font-semibold text-stone-900 dark:text-white">{pendingAdvanceApp.student?.name}</strong> to the next hiring stage?
+ Are you sure you want to advance <strong className="font-semibold text-stone-900 dark:text-white">{pendingAdvanceApp.student?.name || "this candidate"}</strong> to the next hiring stage?
</p>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {pendingAdvanceApp && ( | |
| <div className="space-y-4"> | |
| <p className="text-sm text-stone-600 dark:text-stone-400"> | |
| Are you sure you want to advance <strong className="font-semibold text-stone-900 dark:text-white">{pendingAdvanceApp.student?.name}</strong> to the next hiring stage? | |
| </p> | |
| <p className="text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/20 p-2.5 rounded-lg border border-amber-200/30 dark:border-amber-900/30 leading-normal"> | |
| Warning: Advancing this candidate will update their hiring stage and create a new round submission. | |
| </p> | |
| </div> | |
| )} | |
| {pendingAdvanceApp && ( | |
| <div className="space-y-4"> | |
| <p className="text-sm text-stone-600 dark:text-stone-400"> | |
| Are you sure you want to advance <strong className="font-semibold text-stone-900 dark:text-white">{pendingAdvanceApp.student?.name || "this candidate"}</strong> to the next hiring stage? | |
| </p> | |
| <p className="text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/20 p-2.5 rounded-lg border border-amber-200/30 dark:border-amber-900/30 leading-normal"> | |
| Warning: Advancing this candidate will update their hiring stage and create a new round submission. | |
| </p> | |
| </div> | |
| )} |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@client/src/module/recruiter/applications/ApplicationsList.tsx` around lines
97 - 106, The confirmation message can render an empty <strong> when
pendingAdvanceApp.student?.name is missing; update the JSX in ApplicationsList
(the interpolation inside the <strong> in the pendingAdvanceApp block) to use a
safe fallback (e.g., pendingAdvanceApp.student?.name ?? "this candidate" or
"Unnamed candidate") so the UI always shows a readable name, keeping the rest of
the message unchanged.
Code Review — PR #1406: fix(recruiter): restore applicant list when clearing searchHi @YAXH64, the search trim fix and pagination data-flow improvement are solid. One coordination note. 🟡 Merge conflict:
|
219f134
into
Sachinchaurasiya360:main
Pull Request
Description
Fixes an issue where clearing the applicant search field in the Recruiter Applications page would leave the UI in an empty state instead of restoring the full applicant list.
Root Cause
The component maintained pagination data in local React state while application data was managed by React Query. When a recruiter cleared the search field, React Query served cached results for the original query key, but the query function did not execute again. Because pagination state was updated inside the query function, the pagination state became out of sync with the cached application data, causing the page to incorrectly display an empty state.
Changes Made
applicationsandpaginationfrom the React Query query function.setPagination) from the query function.Benefits
queryFn).Related Issue
Fixes #1142
Type of Change
Testing
Manual Testing
Validation
Screenshots / Video
No UI changes in this PR
Checklist
.env, credentials, ornode_modulescommittedSummary by CodeRabbit
New Features
Bug Fixes