Skip to content

Comments

Fix useEffect dependencies in PlatformInviteLanding#55

Draft
Copilot wants to merge 2 commits intofeature/invitefrom
copilot/sub-pr-54
Draft

Fix useEffect dependencies in PlatformInviteLanding#55
Copilot wants to merge 2 commits intofeature/invitefrom
copilot/sub-pr-54

Conversation

Copy link

Copilot AI commented Nov 22, 2025

Addresses React hooks violation in PlatformInviteLanding.tsx where useEffect was missing dependencies and handleAccept was being recreated on every render.

Changes

  • Wrapped handleAccept in useCallback with dependencies: invitation, session, router, addToast
  • Added handleAccept and accepting to useEffect dependency array
// Before: handleAccept recreated on every render, missing from deps
useEffect(() => {
  if (session && invitation?.status === 'PENDING' && !accepting) {
    handleAccept();
  }
}, [session, invitation]);

// After: stable function reference, complete dependencies
const handleAccept = useCallback(async () => {
  // ... implementation
}, [invitation, session, router, addToast]);

useEffect(() => {
  if (session && invitation?.status === 'PENDING' && !accepting) {
    handleAccept();
  }
}, [session, invitation, handleAccept, accepting]);

Prevents duplicate API calls during auto-accept flow and satisfies React exhaustive-deps rule.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Nov 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
smart-todo Error Error Nov 22, 2025 11:48pm
smart-todo-wum3 Error Error Nov 22, 2025 11:48pm

Co-authored-by: chemist-god <117123746+chemist-god@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 22, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/smart-todo/smart-todo/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.17.1&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-22T23:39:13Z&#34;,&#34;project_hash&#34;:&#34;85c6752e&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/smart-todo/smart-todo/node_modules/.bin/prisma&#34;,&#34;cli_path_hash&#34;:&#34;e76bd0cf&#34;, (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on register API route implementation Fix useEffect dependencies in PlatformInviteLanding Nov 22, 2025
Copilot AI requested a review from chemist-god November 22, 2025 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants