Merged
Conversation
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.
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.
flegaspi700
added a commit
that referenced
this pull request
Nov 4, 2025
Updated documentation to reflect completed fixes: 1. FUTURE-WORK.md: - Moved conversation sorting & title fixes to "Recently Completed" - Added technical details and PR references - Updated coverage stats (63.29%) 2. conversation-sorting-rearranges-on-selection.md: - Added complete resolution section documenting PR #24 - Explained the three-location bug (saveConversation, handleLoadConversation, auto-save effect) - Documented the root cause: auto-save effect dependency on currentConversationId - Added solution with code examples 3. conversation-title-not-updating-in-ui.md: - Updated status to RESOLVED with PR #22 reference - Clarified root cause: component display logic, not state management - Added test count (511 tests passing) 4. conversation-title.test.tsx: - Changed BUG comment to "Fixed" since issue is resolved All issues documented as resolved with proper cross-references.
flegaspi700
added a commit
that referenced
this pull request
Nov 4, 2025
Updated documentation to reflect completed fixes: 1. FUTURE-WORK.md: - Moved conversation sorting & title fixes to "Recently Completed" - Added technical details and PR references - Updated coverage stats (63.29%) 2. conversation-sorting-rearranges-on-selection.md: - Added complete resolution section documenting PR #24 - Explained the three-location bug (saveConversation, handleLoadConversation, auto-save effect) - Documented the root cause: auto-save effect dependency on currentConversationId - Added solution with code examples 3. conversation-title-not-updating-in-ui.md: - Updated status to RESOLVED with PR #22 reference - Clarified root cause: component display logic, not state management - Added test count (511 tests passing) 4. conversation-title.test.tsx: - Changed BUG comment to "Fixed" since issue is resolved All issues documented as resolved with proper cross-references.
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.
No description provided.