-
Notifications
You must be signed in to change notification settings - Fork 542
[Dashboard] Fix peak rate date formatting with error handling #7271
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
[Dashboard] Fix peak rate date formatting with error handling #7271
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Caution Review failedThe pull request is closed. WalkthroughThe code refactors how the peak rate date is formatted and displayed. It introduces a self-invoking function to handle date parsing and formatting, including error handling. The rendered output now uses this precomputed value and displays a fallback message if the date is invalid or absent. It also updates percentage calculations for successful and rate-limited requests to handle zero total requests correctly. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI Component
participant Formatter as Date Formatting Function
UI->>Formatter: Parse and format peakRate.date
alt Date is valid
Formatter-->>UI: Formatted date string
UI->>UI: Render formatted date
else Date is invalid or absent
Formatter-->>UI: null
UI->>UI: Render fallback message
end
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ 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 (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7271 +/- ##
=======================================
Coverage 55.57% 55.57%
=======================================
Files 909 909
Lines 58667 58667
Branches 4158 4158
=======================================
Hits 32606 32606
Misses 25954 25954
Partials 107 107
🚀 New features to boost your workflow:
|
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: 1
🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/page.tsx (1)
128-128
: Externalize fallback message and enable i18nThe inline string
"No Requests in last 24 hours"
is duplicated UI text. Extract it into a constant or pipe it through your localization framework to ensure consistency and easier future updates.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/page.tsx
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Unit Tests
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Build Packages
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/page.tsx
Outdated
Show resolved
Hide resolved
size-limit report 📦
|
ee79198
to
e90f5cc
Compare
This PR adds error handling for parsing peak rate dates in the RPC Usage dashboard. It extracts the date formatting logic into a separate function that catches and logs any parsing errors, preventing potential rendering failures when invalid date formats are encountered.
Summary by CodeRabbit
PR-Codex overview
This PR focuses on enhancing the handling and formatting of the
peakRate.date
in theRPCUsage
component, improving date parsing and display logic, and refining success rate calculations.Detailed summary
parseISO
import fromdate-fns
.peakRateDate
function to parse and formatpeakRate.date
.peakRateDate
in the render method.