Skip to content

[#632] Fix first-connect race in useConnectedIdentity#648

Merged
realproject7 merged 1 commit intomainfrom
task/632-fix-connect-race
Mar 30, 2026
Merged

[#632] Fix first-connect race in useConnectedIdentity#648
realproject7 merged 1 commit intomainfrom
task/632-fix-connect-race

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • useConnectedIdentity.ts: register-by-wallet was fire-and-forget while getFarcasterProfile ran in parallel. On first connect, the DB was empty so profile fetch fell through to external APIs — doubling SteemHunt/Neynar calls.
  • Now awaits register completion before fetching profile, so DB is populated first and getFarcasterProfile reads from cache.

Fixes #632
Tracks realproject7/agent-os#311

Test plan

  • First wallet connect makes only 1 round of SteemHunt/Neynar calls (not 2)
  • Profile still resolves correctly on first connect
  • Subsequent page loads read from DB (no external API calls)
  • Build passes

🤖 Generated with Claude Code

useConnectedIdentity fired register-by-wallet (fire-and-forget) and
getFarcasterProfile in parallel, causing double SteemHunt/Neynar API
calls on first connect since DB was empty when profile fetch ran.

Now awaits register completion before fetching profile, so the DB is
populated first and getFarcasterProfile reads from cache.

Fixes #632

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 30, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Mar 30, 2026 6:41pm

Request Review

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVE

Summary

The PR fixes the first-connect race in useConnectedIdentity by waiting for the register-by-wallet request before running the DB-first profile lookup, and it stays scoped to that issue.

Findings

  • None.

Decision

Approving on code review. The async ordering now matches the issue requirements, preserves the non-fatal register path, and does not introduce unrelated changes.

@realproject7 realproject7 merged commit aedbab0 into main Mar 30, 2026
5 checks passed
@realproject7 realproject7 deleted the task/632-fix-connect-race branch March 30, 2026 18:44
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.

Fix double API calls on first wallet connect — race condition in useConnectedIdentity

2 participants