Skip to content

fix: implemented missing onClick handler for dynamic active session revocation (#44)#68

Merged
deekshithgowda85 merged 2 commits into
deekshithgowda85:prodfrom
prakshithamalla-art:fix-session-revoke-handler-44
May 31, 2026
Merged

fix: implemented missing onClick handler for dynamic active session revocation (#44)#68
deekshithgowda85 merged 2 commits into
deekshithgowda85:prodfrom
prakshithamalla-art:fix-session-revoke-handler-44

Conversation

@prakshithamalla-art
Copy link
Copy Markdown
Contributor

@prakshithamalla-art prakshithamalla-art commented May 30, 2026

Closes #44

🎯 Overview & Motivation

The active hardware configuration session log cards inside the profile page (components/console/account-page-client.tsx) rendered a decorative "Revoke" styling block that lacked an attached onClick action function.

This PR turns the static mock dataset into a responsive local state array, integrates an async handleRevokeSession routine, requires active deletion intent confirmation, and filters out the targeted object node seamlessly upon API resolution.

🛠️ Changes Implemented

  • Converted hardcoded session logs to an interactive React state layout array.
  • Configured native interceptor network boundaries for secure connection teardowns.

Summary by CodeRabbit

  • New Features
    • Users can now revoke active sessions directly from the account page with a confirmation prompt to prevent accidental removals.
    • Successfully revoked sessions are immediately removed from the active sessions list.
    • Error notifications inform users when revocation attempts fail.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

@deekshithgowda85 is attempting to deploy a commit to the Deekshith Gowda HS's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@prakshithamalla-art, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 56 minutes and 34 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 02f9d258-dc10-4169-8d78-b99f5adaca0f

📥 Commits

Reviewing files that changed from the base of the PR and between 473118b and 2d63f3a.

📒 Files selected for processing (1)
  • components/console/account-page-client.tsx
📝 Walkthrough

Walkthrough

The PR implements session revocation in the account page by introducing local state management for sessions, adding an async handler that confirms and calls the backend DELETE endpoint, and wiring the revoke button to trigger the handler with success/failure alerts and state updates.

Changes

Session Revocation Feature

Layer / File(s) Summary
Session state initialization
components/console/account-page-client.tsx
Sessions state array initialized with two session entries containing id, device, location, and current flags.
Session revocation handler and API integration
components/console/account-page-client.tsx
handleRevokeSession async function confirms user intent, sends DELETE request to /api/user/sessions with session id, removes the session from local state on success, and shows alerts on API or network errors.
Session list rendering and revoke button wiring
components/console/account-page-client.tsx
Active Sessions section now renders from sessions state; Revoke button per session invokes handleRevokeSession with the session id and device instead of being static.

Sequence Diagram

sequenceDiagram
  participant User
  participant AccountPageClient
  participant API as /api/user/sessions
  User->>AccountPageClient: Click Revoke button
  AccountPageClient->>User: Confirm revocation (alert)
  User->>AccountPageClient: Confirm
  AccountPageClient->>API: DELETE with session id
  API->>AccountPageClient: Response (success or error)
  alt Success
    AccountPageClient->>AccountPageClient: Remove session from state
    AccountPageClient->>User: Display success alert
  else Failure
    AccountPageClient->>User: Display error alert
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

quality:clean

Poem

🐰 A rabbit hops through sessions old,
Confirms each revoke with care untold,
The button now speaks to the backend's call,
State updates dance as sessions fall! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing the missing onClick handler for session revocation, which is the core objective of the PR.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #44: adds a revokeSession handler, makes the backend call to /api/user/sessions, and updates UI state by removing revoked sessions.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #44's requirement of implementing the onClick handler for session revocation; no extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deekshithgowda85
Copy link
Copy Markdown
Owner

deekshithgowda85 commented May 30, 2026

Hi @prakshithamalla-art
Could u Correct it otherwise I can't add labels (gssoc guidelines)
Next time less than 100 lines can be merged into one pr(i will add intermediate or advanced)
Try creating issue with more depth (since all commits or 3 to 10 lines).Do multiple in single issue or i will consider a single pr only
I have added those issue for beginner in git and first time contributors(small changes)

@deekshithgowda85
Copy link
Copy Markdown
Owner

Since 3 to 30 lines merge takes redundant Ci and vercel build trigger which may trigger rate limits
So sry NXT tym it won't be encouraged (other pr's cannot be merged )

@prakshithamalla-art prakshithamalla-art force-pushed the fix-session-revoke-handler-44 branch from 6eb20a0 to 473118b Compare May 30, 2026 16:06
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/console/account-page-client.tsx (1)

227-233: ⚡ Quick win

Prevent repeated revoke clicks while request is in flight.

Rapid clicks can dispatch duplicate DELETEs for the same session and produce noisy alerts. Add a per-session pending state and disable the button while revocation is running.

🤖 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 `@components/console/account-page-client.tsx` around lines 227 - 233, Add a
per-session pending flag to prevent duplicate revokes: keep a state like
revokedPending (e.g., a Set or Record keyed by session id) and update
handleRevokeSession to first check and return early if revokedPending[s.id] is
true, then set revokedPending[s.id]=true before sending the DELETE and reset it
to false in both success and error paths; update the Revoke button rendering to
disable the button (and adjust styles) when revokedPending[s.id] is true and
avoid dispatching another request while pending; reference handleRevokeSession
and the session id/device (s.id, s.device) to locate where to add the check and
state updates.
🤖 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 `@components/console/account-page-client.tsx`:
- Around line 72-77: The DELETE response handling assumes JSON by calling
res.json() unconditionally; update the logic in the revoke/session-delete
handler (where res.json() and setSessions are used) to guard parsing: if
res.status === 204 or the Content-Type header does not include
"application/json", skip res.json() and treat the response as success when
res.ok, otherwise await res.json(); then use the parsed data (if any) to check
data.ok and only call alert for errors; ensure setSessions((prev) =>
prev.filter((s) => s.id !== id)) still runs on successful res.ok even when no
JSON body is returned.

---

Nitpick comments:
In `@components/console/account-page-client.tsx`:
- Around line 227-233: Add a per-session pending flag to prevent duplicate
revokes: keep a state like revokedPending (e.g., a Set or Record keyed by
session id) and update handleRevokeSession to first check and return early if
revokedPending[s.id] is true, then set revokedPending[s.id]=true before sending
the DELETE and reset it to false in both success and error paths; update the
Revoke button rendering to disable the button (and adjust styles) when
revokedPending[s.id] is true and avoid dispatching another request while
pending; reference handleRevokeSession and the session id/device (s.id,
s.device) to locate where to add the check and state updates.
🪄 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: 8e03887f-ae44-4d20-8fd4-a24a1177b324

📥 Commits

Reviewing files that changed from the base of the PR and between d96a51d and 473118b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • components/console/account-page-client.tsx

Comment thread components/console/account-page-client.tsx
@prakshithamalla-art
Copy link
Copy Markdown
Contributor Author

Hi @deekshithgowda85!
Thank you for your patience and for clarifying the repo's guidelines! I have force-pushed a completely clean update to this branch. The PR now contains a consolidated diff addressing only Issue #44, and the duplicate next-auth build import has been completely removed.
The CI build pipeline is now completely green (Passed in 55s) with zero merge conflicts.
I completely understand your point regarding smaller micro-patches, Vercel build minute optimizations, and deep-dive issues. Moving forward, I will group minor refactors and structural adjustments into singular, multi-scoped issues or single robust PRs to respect the project's build limits.
Thank you for assigning the exceptional quality tags! Ready for your final review and merge.

@deekshithgowda85 deekshithgowda85 merged commit 1b1e993 into deekshithgowda85:prod May 31, 2026
2 of 3 checks passed
@deekshithgowda85
Copy link
Copy Markdown
Owner

Hi @deekshithgowda85! Thank you for your patience and for clarifying the repo's guidelines! I have force-pushed a completely clean update to this branch. The PR now contains a consolidated diff addressing only Issue #44, and the duplicate next-auth build import has been completely removed. The CI build pipeline is now completely green (Passed in 55s) with zero merge conflicts. I completely understand your point regarding smaller micro-patches, Vercel build minute optimizations, and deep-dive issues. Moving forward, I will group minor refactors and structural adjustments into singular, multi-scoped issues or single robust PRs to respect the project's build limits. Thank you for assigning the exceptional quality tags! Ready for your final review and merge.

Still repeating small pr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IMPROVEMENT — Session revoke button missing handler

2 participants