-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor: Unify session loading functions and simplify API #87
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
Merged
Conversation
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
## Walkthrough
The changes refactor session event handling by replacing domain-specific types (`SessionEvent`, `SessionTimeline`) with generic ones (`Event`, `Timeline`), unify and rename loading functions into a single `loadTimelines` function with simplified filtering, and update all related imports and type annotations across the codebase and tests accordingly. No core logic or control flow is changed.
## Changes
| File(s) | Change Summary |
|----------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| src/core/parser/index.ts | Replaced domain-specific types with generic ones; renamed `loadSessionsInTimeRange` → `loadTimelines`; removed `loadAllSessions`; simplified event loading and grouping logic. |
| src/models/models.ts | Renamed `SessionEventSchema` → `EventSchema`, `SessionEvent` → `Event`, and `SessionTimeline` → `Timeline`; updated interface property types accordingly. |
| src/ui/App.tsx | Updated imports and state types to use `Timeline` and `loadTimelines`; replaced calls to old session-loading functions with unified `loadTimelines`. |
| src/ui/ProjectTable.tsx | Updated import and prop type from `SessionTimeline` to `Timeline`. |
| src/ui/components/ProjectRow.tsx | Updated import and prop type from `SessionTimeline` to `Timeline`. |
| src/ui/components/TimelineBar.tsx | Updated import and prop type from `SessionTimeline` to `Timeline`. |
| src/ui/utils/tableUtils.ts | Updated import and function parameter type from `SessionTimeline[]` to `Timeline[]`. |
| src/utils/__tests__/project-filter.test.ts | Updated imports, function signatures, and mock data types from `SessionTimeline` to `Timeline`. |
| src/utils/__tests__/sort.test.ts | Updated imports and mock data types from `SessionTimeline` to `Timeline`. |
| src/utils/sort.ts | Updated import and function parameter/return types from `SessionTimeline[]` to `Timeline[]`. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant UI as App.tsx
participant Parser as Parser Module
UI->>Parser: loadTimelines({startTime?, endTime?, projectNames?}, progressTracker)
Parser->>Parser: scan project directories for .jsonl files
Parser->>Parser: parse and validate events using EventSchema
Parser->>Parser: filter events by time and project names
Parser->>Parser: group events by repository
Parser->>Parser: create timelines from grouped events
Parser-->>UI: Promise<Timeline[]>Possibly related PRs
Poem
|
- Remove loadAllSessions function as it was redundant - Rename loadSessionsInTimeRange to loadSessions for clarity - Update App component to use unified loadSessions function - Simplify parameter handling in session loading logic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
059e0fc to
91be8e0
Compare
|
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
loadAllSessionsfunctionloadSessionsInTimeRangetoloadSessionsfor better clarityTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Chores