roblox api + random quote + some syntax errors saturn made#122
roblox api + random quote + some syntax errors saturn made#122breadddevv merged 6 commits intoPlanetaryOrbit:mainfrom
Conversation
Added mobile detection and adjusted layout for responsiveness.
📝 WalkthroughWalkthroughThe changes refactor Roblox user information fetching and caching across utility modules. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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: 3
🧹 Nitpick comments (1)
utils/roblox.ts (1)
53-58: Shim exports cause duplicate API calls when both are used separately.These shim functions each call
getRobloxUserInfo()independently. If a caller uses bothgetRobloxUsername(id)andgetRobloxDisplayName(id)directly (bypassing the caching layer inuserinfoEngine.ts), they will make 2 API calls instead of 1.Consider documenting that callers should prefer
getRobloxUserInfo()directly when both values are needed, or use the cachedgetUsername/getDisplayNamefromuserinfoEngine.ts.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@utils/roblox.ts` around lines 53 - 58, The two shim exports getRobloxUsername and getRobloxDisplayName each call getRobloxUserInfo separately, causing duplicate API calls when a caller needs both values; update the file to add a clear documentation comment above these functions stating that callers who need both username and displayName should call getRobloxUserInfo(id) directly or use the cached helpers getUsername/getDisplayName from userinfoEngine.ts to avoid double requests, and keep the shims as-is for single-field convenience.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@utils/randomText.ts`:
- Around line 82-84: Fix the spacing inconsistency in the template string "`Late
shift? Stay sharp, ${name}🦉`" by inserting a space between the ${name}
placeholder and the emoji so it matches the other entries (i.e., change to
"`Late shift? Stay sharp, ${name} 🦉`"); locate this string in the messages
array or function that returns random texts (e.g., in utils/randomText.ts) and
update the literal accordingly.
In `@utils/roblox.ts`:
- Around line 44-51: Callers are still passing an origin argument to
getRobloxUserId even though the parameter was removed, causing TS errors;
restore backwards compatibility by re-adding an optional origin?: string
parameter to the getRobloxUserId function in utils/roblox.ts (keep the existing
implementation and ignore or optionally log/use origin) so calls from
pages/api/auth/login.ts and pages/api/setupworkspace.ts compile, or
alternatively update those two call sites to stop passing
req.headers.origin—pick one approach and apply it consistently.
In `@utils/userinfoEngine.ts`:
- Around line 35-37: getThumbnail is synchronous but callers await it; change
its signature to async so it returns a Promise<string> for API consistency with
getUsername/getDisplayName and to allow callers to keep using await. Update the
function declaration getThumbnail(userId: number | bigint) to be async and
return the same URL string (e.g., use an async function or return
Promise.resolve(`/api/workspace/[id]/avatar/${userId}`)); no caller changes
required if you make this change. Ensure exported type remains compatible
(Promise<string>).
---
Nitpick comments:
In `@utils/roblox.ts`:
- Around line 53-58: The two shim exports getRobloxUsername and
getRobloxDisplayName each call getRobloxUserInfo separately, causing duplicate
API calls when a caller needs both values; update the file to add a clear
documentation comment above these functions stating that callers who need both
username and displayName should call getRobloxUserInfo(id) directly or use the
cached helpers getUsername/getDisplayName from userinfoEngine.ts to avoid double
requests, and keep the shims as-is for single-field convenience.
🪄 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: c53225f5-06b5-4ff3-9c27-ab71f2a0c300
📒 Files selected for processing (4)
pages/welcome.tsxutils/randomText.tsutils/roblox.tsutils/userinfoEngine.ts
What's changed
utils/userinfoEngine.ts+utils/roblox.ts— batched Roblox API callsgetRobloxUserInfo()which fetches username and display name in a singlenoblox.getUserInfo()call instead of two separate requestsuserinfoEngine.tsto use the batched fetch warming eithergetUsernameorgetDisplayNamenow primes both in cache simultaneouslyNodeCacheinstances into one with a 5-minute TTL (previously cached forever)!== undefined, preventing false hits on empty stringsnobloxandgetRobloxThumbnailimportsgetRobloxUsernameandgetRobloxDisplayNameas shim exports for backwards compatibilityutils/randomText.ts— bug fixes + new quotesafternoonOnlyTextsandlateNightTextsthat caused a runtime syntax error,,) inlateNightTexts};on therandomTextfunctionOrbit is running smooth. Thanks for supporting our project, ${name} 🙌Quiet hours are the best for deep management. Go get 'em, ${name}. ⌨️Summary by CodeRabbit