fix: resolve TypeScript type mismatch in SessionStats component#563
Closed
github-actions[bot] wants to merge 1 commit intodevfrom
Closed
fix: resolve TypeScript type mismatch in SessionStats component#563github-actions[bot] wants to merge 1 commit intodevfrom
github-actions[bot] wants to merge 1 commit intodevfrom
Conversation
Fixed TypeScript type mismatch where SessionStats component expected string | null for firstRequestAt/lastRequestAt but received Date | null from the aggregateSessionStats repository function. Changed interface to accept Date | string | null which is compatible with both the data source and the existing TimeRow component behavior (new Date() accepts both Date and string inputs). CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20785864568 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionStatscomponent expectedstring | nullforfirstRequestAt/lastRequestAtbut receivedDate | nullfrom theaggregateSessionStatsrepository functionDate | string | nullwhich is compatible with both the data source and the existingTimeRowcomponent behaviorRoot Cause
The
aggregateSessionStatsfunction insrc/repository/message.tsreturnsfirstRequestAt: Date | nullandlastRequestAt: Date | null, but theSessionStatscomponent's interface expectedstring | null. TheTimeRowhelper function already handles both types correctly vianew Date(date).Changes Made
session-stats.tsxfirstRequestAtandlastRequestAttypes fromstring | nulltoDate | string | nullsession-stats.tsxTimeRowfunction parameter type to matchTest Plan
bun run typecheckpassesnew Date()accepts bothDateandstringinputsRelated
Auto-generated by Claude AI
Greptile Summary
This PR resolves a TypeScript type mismatch between the database layer and UI component. The
aggregateSessionStatsfunction insrc/repository/message.ts:289-290returnsfirstRequestAt: Date | nullandlastRequestAt: Date | nullfrom SQL queries, but theSessionStatscomponent interface was typed asstring | null. The fix correctly updates the interface to acceptDate | string | null, which is compatible with both the data source and the existingTimeRowcomponent that already handles both types vianew Date(date).Key Changes:
SessionStatsPropsinterface to acceptDate | string | nullfor timestamp fieldsTimeRowfunction parameter type to match the interfaceVerification:
aggregateSessionStats()→getSessionDetails()→SessionStatscomponentTimeRowalready handles bothDateandstringcorrectly vianew Date()constructorConfidence Score: 5/5
TimeRowcomponent's use ofnew Date(date)handles bothDateobjects and date strings identically, so there are no runtime behavior changes. The fix resolves the TypeScript compilation error and accurately reflects the actual data flow from database to UI.Important Files Changed
firstRequestAtandlastRequestAtfrom `stringSequence Diagram
sequenceDiagram participant Client as SessionMessagesClient participant Action as getSessionDetails() participant Repo as aggregateSessionStats() participant DB as Database participant UI as SessionStats Component Client->>Action: getSessionDetails(sessionId) Action->>Repo: aggregateSessionStats(sessionId) Repo->>DB: SQL Query (min/max createdAt) DB-->>Repo: Returns Date | null Note over DB,Repo: firstRequestAt: Date | null<br/>lastRequestAt: Date | null Repo-->>Action: Stats with Date types Action-->>Client: sessionStats data Client->>UI: Render with stats prop Note over UI: Interface now accepts<br/>Date | string | null UI->>UI: TimeRow: new Date(date) Note over UI: new Date() handles<br/>both Date and string