Skip to content

feat: migrate room artist lookup to dedicated chats api#1613

Merged
sweetmantech merged 3 commits intotestfrom
codex/arpit-migrate-room-artist-endpoint
Mar 31, 2026
Merged

feat: migrate room artist lookup to dedicated chats api#1613
sweetmantech merged 3 commits intotestfrom
codex/arpit-migrate-room-artist-endpoint

Conversation

@arpitgupta1214
Copy link
Copy Markdown
Collaborator

Summary

  • migrate useArtistFromRoom to dedicated GET /api/chats/{id}/artist
  • use bearer auth via useAccessToken
  • respect API override via useApiOverride
  • remove local route app/api/room/artist/route.tsx

Validation

  • pnpm exec eslint hooks/useArtistFromRoom.ts
  • rg -n "/api/room/artist|room/artist" --glob "!**/node_modules/**"

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 23 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 23 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c9f8ba61-636d-4952-bb44-17266bdf4451

📥 Commits

Reviewing files that changed from the base of the PR and between f7e799a and 7bdd2e5.

📒 Files selected for processing (3)
  • app/api/room/artist/route.tsx
  • hooks/useArtistFromRoom.ts
  • lib/chats/getChatArtist.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/arpit-migrate-room-artist-endpoint

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.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 30, 2026

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

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Mar 31, 2026 3:52am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac59a7b6e3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 22 to 23
if (hasRun.current || !roomId || !userData?.id || !accessToken) return;
hasRun.current = true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Set run guard only after successful artist lookup

This sets hasRun.current = true before the network request, so any transient failure from the new bearer-auth endpoint (for example a 401 during token refresh or a temporary 5xx) permanently disables retries for this chat mount, leaving selectedArtist unset even if accessToken or baseUrl later changes. Since this migration moved lookup to an authenticated external API, this failure mode is now much more likely and should be retried instead of being latched on first attempt.

Useful? React with 👍 / 👎.

Previously hasRun was set before the API call, so transient failures
(401 during token refresh, 5xx) permanently blocked retries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
const apiOverride = useApiOverride();
const baseUrl = apiOverride || NEW_API_BASE_URL;

useEffect(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

DRY

  • actual: useEffect in the hook.
  • required: useQuery from tanstack

- Extract fetch to lib/chats/getChatArtist.ts (SRP)
- Use useQuery with staleTime: Infinity (replaces hasRun ref)
- Use getAccessToken from Privy directly (KISS)
- TanStack handles retries, caching, and dedup automatically

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sweetmantech sweetmantech merged commit e385b67 into test Mar 31, 2026
3 checks passed
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