Skip to content

fix: correct SessionStats type mismatch for date fields#562

Closed
github-actions[bot] wants to merge 1 commit intodevfrom
claude-fix-pr-561-20785613467
Closed

fix: correct SessionStats type mismatch for date fields#562
github-actions[bot] wants to merge 1 commit intodevfrom
claude-fix-pr-561-20785613467

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Jan 7, 2026

Greptile Overview

Greptile Summary

This PR fixes a TypeScript type mismatch where SessionStats component expected string | null for date fields, but aggregateSessionStats returns Date | null from the database.

Changes made:

  • Updated firstRequestAt and lastRequestAt types from string | null to Date | string | null in both the SessionStatsProps interface and TimeRow function parameter
  • Removed unused Tooltip component imports that were no longer referenced
  • Reorganized imports to comply with biome linting rules (lucide-react imports before next-intl)

Why this is safe:

  • The TimeRow function already uses new Date(date) which handles both Date objects and strings correctly
  • The type change is backwards compatible (more permissive, not restrictive)
  • No runtime behavior changes - the component works identically before and after
  • Verified data flow: Database SQL query returns DateaggregateSessionStats returns Date | nullgetSessionDetails passes it through → Component now correctly accepts it

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it's a straightforward type fix with no logic changes
  • Score reflects that this is a pure type correction that aligns the component interface with actual database return types. The runtime code already handles both Date and string inputs correctly via new Date() constructor. The changes are minimal, well-documented, and include cleanup of unused imports. All tests pass (typecheck and lint verified).
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/app/[locale]/dashboard/sessions/[sessionId]/messages/_components/session-stats.tsx 5/5 Type fix for date fields to match database return type, unused imports removed, imports reorganized per linting rules

Sequence Diagram

sequenceDiagram
    participant UI as SessionStats Component
    participant Client as SessionMessagesClient
    participant Action as getSessionDetails
    participant Repo as aggregateSessionStats
    participant DB as Database

    Client->>Action: getSessionDetails(sessionId)
    Action->>Repo: aggregateSessionStats(sessionId)
    Repo->>DB: SQL query with min/max createdAt
    DB-->>Repo: firstRequestAt: Date, lastRequestAt: Date
    Repo-->>Action: stats with Date | null fields
    Action-->>Client: sessionStats with Date | null
    Client->>UI: <SessionStats stats={sessionStats} />
    UI->>UI: TimeRow receives Date | string | null
    UI->>UI: new Date(date) handles both types
Loading

Fixed TypeScript type errors in session-stats.tsx:
- Changed firstRequestAt/lastRequestAt types from 'string | null' to 'Date | string | null'
- This aligns with aggregateSessionStats return type which uses Date objects
- Also removed unused Tooltip imports (pre-existing lint issue)
- Reorganized imports per biome lint rules

CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20785613467

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@ding113 ding113 closed this Jan 7, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Jan 7, 2026
@ding113 ding113 deleted the claude-fix-pr-561-20785613467 branch January 27, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant

Comments