-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/conversation sorting and pinning #23
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
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
- Fix 'children' prop missing error by passing undefined instead of empty - All 11 tests still passing - Resolves TypeScript compilation error
TDD Red Phase: - Created 8 failing tests for sorting stability and pin functionality - Tests covered: load without reorder, pin/unpin, mixed sorting Root Cause Analysis: - saveConversation() updated updatedAt timestamp even when loading - loadConversations() sorted by updatedAt descending - Result: Selected conversation jumped to top of list TDD Green Phase - Sorting Fix: - Added updateTimestamp parameter to saveConversation() (default: true) - Added isLoadingConversationRef flag in page.tsx - Auto-save effect skips when loading conversation from history - Conversations only reorder when content actually changes TDD Green Phase - Pin Feature: - Added isPinned field to Conversation type - Added togglePinConversation() function in storage.ts - Updated loadConversations() to sort: pinned first, then unpinned - Both sections sorted by updatedAt descending - Backwards compatible: isPinned defaults to false UI Implementation: - Added Star icon button to conversation items - Visual distinction: yellow background for pinned conversations - Filled star for pinned, outline for unpinned - Toast notifications on pin/unpin actions - Hover states and accessibility labels Testing Results: - All 8 new tests passing - All 519 existing tests passing (no regressions) - Test file: src/__tests__/lib/conversation-sorting.test.ts Documentation: - Updated README.md with new feature - Documented issue resolution in docs/04-development/issues/ - Added to recent updates section Impact: - Conversation list stays stable when browsing history - Important conversations can be pinned to top - Better UX for power users with many conversations
TypeScript was complaining that 'ai' string literal wasn't assignable to the union type 'user' | 'ai'. Using 'as const' ensures the literal type is preserved. Fixes CI typecheck error.
flegaspi700
added a commit
that referenced
this pull request
Nov 4, 2025
Found three locations where saveConversation() was updating timestamps during conversation loads, causing list to reorder: 1. ✅ saveConversation() itself - added updateTimestamp parameter (PR #23) 2. ✅ handleLoadConversation() - now uses updateTimestamp: false 3. ✅ Auto-save effect - now uses updateTimestamp: false The auto-save effect was triggering when currentConversationId changed during load. Even with isLoadingConversationRef flag, the effect would run and update the timestamp. Solution: - Auto-save effect now uses updateTimestamp: false to prevent timestamp updates when just preserving state - Explicit timestamp update added in onComplete callback when user sends new messages (the only time we actually want to update the timestamp) This ensures conversations only move to top when users send new messages, not when just selecting from history. Fixes persistent sorting issue confirmed by user.
flegaspi700
added a commit
that referenced
this pull request
Nov 4, 2025
* fix: prevent timestamp updates during conversation loads (complete fix) Found three locations where saveConversation() was updating timestamps during conversation loads, causing list to reorder: 1. ✅ saveConversation() itself - added updateTimestamp parameter (PR #23) 2. ✅ handleLoadConversation() - now uses updateTimestamp: false 3. ✅ Auto-save effect - now uses updateTimestamp: false The auto-save effect was triggering when currentConversationId changed during load. Even with isLoadingConversationRef flag, the effect would run and update the timestamp. Solution: - Auto-save effect now uses updateTimestamp: false to prevent timestamp updates when just preserving state - Explicit timestamp update added in onComplete callback when user sends new messages (the only time we actually want to update the timestamp) This ensures conversations only move to top when users send new messages, not when just selecting from history. Fixes persistent sorting issue confirmed by user. * fix: remove currentConversationId from auto-save effect dependencies The root cause was the auto-save effect depending on currentConversationId. When loading a conversation, setCurrentConversationId() would trigger the effect, causing an unwanted save that updated the timestamp. Changes: 1. Removed currentConversationId from effect dependencies 2. Removed "|| currentConversationId" from the if condition (only save when there are messages) 3. Added explicit saveConversation(conversation, true) in onComplete callback to update timestamp when user sends messages 4. Updated comments to explain why currentConversationId is not in dependencies This ensures the effect only runs when actual content (messages, files, aiTheme) changes, not when just switching conversations. Fixes the persistent sorting issue where conversations jump to top when selected.
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.
No description provided.