-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Log rejected promises when recording clicks #2476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe update refactors the handling of multiple asynchronous operations in the Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/lib/tinybird/record-click.ts (1)
197-201: Enhance error logging with operation context.The error detection and logging logic is well-implemented, but could be more informative by indicating which specific operations failed.
Consider enhancing the error logging to provide more context:
// Find the rejected promises and log them if (response.some((result) => result.status === "rejected")) { - const errors = response.filter((result) => result.status === "rejected"); - console.error("[Record click] - Rejected promises", errors); + const operations = ['tinybird_api', 'click_cache', 'click_data_cache', 'link_update', 'workspace_update', 'workspace_fetch']; + const errors = response + .map((result, index) => ({ operation: operations[index], result })) + .filter(({ result }) => result.status === "rejected"); + console.error("[Record click] - Rejected promises", errors); }This would help identify which specific operations are failing during debugging.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/lib/tinybird/record-click.ts(2 hunks)
🔇 Additional comments (2)
apps/web/lib/tinybird/record-click.ts (2)
152-152: Good refactoring to enable error handling.Storing the entire
Promise.allSettledresponse enables the new error checking logic while maintaining the original functionality.
203-203: Destructuring maintains original behavior correctly.The destructuring approach correctly extracts
workspaceRowsfrom the 5th position, maintaining the same behavior as the previous implementation.
Summary by CodeRabbit