fixed sorting by ID bug#218
Merged
its-me-abhishek merged 1 commit intoCCExtractor:mainfrom Nov 25, 2025
Merged
Conversation
its-me-abhishek
approved these changes
Nov 25, 2025
ShivaGupta-14
pushed a commit
to ShivaGupta-14/ccsync
that referenced
this pull request
Dec 25, 2025
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.
Description
Previously, sorting tasks manually (e.g., by ID or description) would appear to work initially, but the order would be unexpectedly overridden whenever filters or other state changes triggered a re-render. The source of the problem was that sortWithOverdueOnTop() always applied a second sort — forcing sorting by ID again — which erased the user’s intended sort order.
What was causing it:
The useEffect that filters tasks also re-applied sorting.
Inside sortWithOverdueOnTop(), we performed:
return b.id - a.id;Which forced DESC ID sorting again every time the effect ran, overriding any custom sorting logic.
Fix introduced:
Updated sortWithOverdueOnTop() to only enforce the overdue-first rule, without altering the order of non-overdue tasks:
return 0;This preserves the user’s chosen sorting order while still keeping overdue tasks at the top.
Ensured that manual sorting functions (handleIdSort, handleSort) continue to work correctly without unexpected overrides.
Result:
✔ Overdue tasks always stay on top
✔ User-initiated sorting (ID, alphabetical, etc.) is preserved
✔ No more sorting conflicts when filters or state updates occur
✔ Improved UX consistency in the Tasks table
- Fixes: #215
video after changes
Screencast.from.22-11-25.11.30.02.PM.IST.webm