Hardcode growth metrics with time-based increments#5470
Conversation
Replace API-fetched stats with hardcoded baseline values that grow over time: - Requests: 3 billion base, +50 million/day - Tokens: 31.5 trillion base, +1 trillion/month - Users: 20.6 million base, +1 million/month Baseline date is January 2, 2025. Update the constants periodically with real numbers.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Claude finished @chitalian's task —— View job PR Review: Hardcode growth metrics with time-based incrementsScore: 3/10 - Critical SSR hydration issues and several other problems Todo List:
Critical Issues Found1. CRITICAL: SSR Hydration Mismatch (
|
Greptile SummaryThis PR replaces API-fetched growth statistics with hardcoded baseline values that increment over time. The Major changes:
Issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Browser
participant Stats Component
participant Date/Time
User->>Browser: Load homepage
Browser->>Stats Component: Render (client-side)
Stats Component->>Stats Component: Initialize useState with getGrowthMetrics()
Stats Component->>Date/Time: Get current date
Date/Time-->>Stats Component: Return date
Stats Component->>Stats Component: Calculate days since baseline
Stats Component->>Stats Component: Calculate growth metrics
Stats Component-->>Browser: Display metrics
Note over Stats Component: useEffect runs after mount
Stats Component->>Stats Component: setMetrics(getGrowthMetrics())
Stats Component->>Date/Time: Get current date again
Date/Time-->>Stats Component: Return date
Stats Component->>Stats Component: Recalculate metrics
Stats Component-->>Browser: Update display
Browser->>Stats Component: IntersectionObserver triggers
Stats Component->>Stats Component: setIsVisible(true)
Stats Component-->>Browser: Apply rotation animation
|
bifrost/components/home/Stats.tsx
Outdated
| } else if (num >= 1_000) { | ||
| return `${Math.ceil(num / 100) / 10}k+`; | ||
| // Baseline date: January 2, 2025 | ||
| const BASELINE_DATE = new Date("2025-01-02"); |
There was a problem hiding this comment.
logic: hardcoding today's date will cause incorrect calculations after deployment
| const BASELINE_DATE = new Date("2025-01-02"); | |
| const BASELINE_DATE = new Date("2025-01-02T00:00:00Z"); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: bifrost/components/home/Stats.tsx
Line: 8:8
Comment:
**logic:** hardcoding today's date will cause incorrect calculations after deployment
```suggestion
const BASELINE_DATE = new Date("2025-01-02T00:00:00Z");
```
How can I resolve this? If you propose a fix, please make it concise.
bifrost/components/home/Stats.tsx
Outdated
|
|
||
| const Stats = () => { | ||
| const [isVisible, setIsVisible] = useState(false); | ||
| const [metrics, setMetrics] = useState(getGrowthMetrics()); |
There was a problem hiding this comment.
logic: calling getGrowthMetrics() during useState initialization causes SSR/client mismatch - server renders at build time with a different date than client hydration time
| const [metrics, setMetrics] = useState(getGrowthMetrics()); | |
| const [metrics, setMetrics] = useState({ requests: BASELINE_REQUESTS, tokensTrillion: BASELINE_TOKENS_TRILLION, users: BASELINE_USERS }); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: bifrost/components/home/Stats.tsx
Line: 59:59
Comment:
**logic:** calling `getGrowthMetrics()` during `useState` initialization causes SSR/client mismatch - server renders at build time with a different date than client hydration time
```suggestion
const [metrics, setMetrics] = useState({ requests: BASELINE_REQUESTS, tokensTrillion: BASELINE_TOKENS_TRILLION, users: BASELINE_USERS });
```
How can I resolve this? If you propose a fix, please make it concise.
bifrost/components/home/Stats.tsx
Outdated
| const daysSinceBaseline = Math.floor( | ||
| (now.getTime() - BASELINE_DATE.getTime()) / (1000 * 60 * 60 * 24) | ||
| ); | ||
| const monthsSinceBaseline = daysSinceBaseline / 30; |
There was a problem hiding this comment.
style: using 30 days per month for calculation is imprecise and accumulates error over time - February has 28/29 days while other months have 31
| const monthsSinceBaseline = daysSinceBaseline / 30; | |
| const monthsSinceBaseline = daysSinceBaseline / 30.44; // Average days per month |
Prompt To Fix With AI
This is a comment left during a code review.
Path: bifrost/components/home/Stats.tsx
Line: 25:25
Comment:
**style:** using 30 days per month for calculation is imprecise and accumulates error over time - February has 28/29 days while other months have 31
```suggestion
const monthsSinceBaseline = daysSinceBaseline / 30.44; // Average days per month
```
How can I resolve this? If you propose a fix, please make it concise.- Initialize metrics state as null to avoid SSR/client mismatch - Use UTC format for baseline date to ensure consistent timezone handling - Use 30.44 days/month for more accurate month calculations - Extract magic numbers (MS_PER_DAY, DAYS_PER_MONTH) as named constants - Fall back to baseline values during SSR/initial render - Update baseline date to January 6, 2025
- Requests: 4.9 billion (was 3 billion) - Tokens: 1.1 trillion/month (was 31.5 trillion) - Users: 28.6 million (was 20.6 million)
- Requests: 10M/day (was 50M/day) - Tokens & Users: 5% MoM compound growth (was flat rate)
Replace API-fetched stats with hardcoded baseline values that grow over time:
Baseline date is January 2, 2025. Update the constants periodically with real numbers.