Repository navigation
fix(tasks): apply ID sorting on the first click - #483
WiseShrestha wants to merge 1 commit into
Conversation
|
Thank you for opening this PR! Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools. Please take a moment to:
More information on how to conduct a self review: This helps make the review process smoother and gives us a clearer understanding of your thought process. Once you've added your self-review, we'll continue from our side. Thank you! |
| const sortedTasks = sortTasksById(updatedTasks, DEFAULT_ID_SORT_ORDER); | ||
| setTasks(sortedTasks); | ||
| setTempTasks(sortedTasks); | ||
| setIdSortOrder(DEFAULT_ID_SORT_ORDER); |
There was a problem hiding this comment.
Sync reloads the rows in descending ID order. If I had sorted ascending before syncing, the stored direction would still be asc so the next click would apply descending order again and look like it did nothing. Resetting the direction here keeps it aligned with the rows on screen.
| }); | ||
|
|
||
| fireEvent.click(idHeader); | ||
| expect(visibleTaskIds()).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
There was a problem hiding this comment.
The test sorts ascending before syncing so it exercises the stale-state case. It then checks the visible row order after sync and after one click. That catches the extra-click bug, which a test that only checks whether the rows eventually change would miss.
WiseShrestha
left a comment
There was a problem hiding this comment.
I left inline comments explaining why sync resets the stored ID sort direction and how the regression test verifies that the first click after sync sorts ascending.
Description
Keep the stored ID sort direction aligned with the descending order applied on initial load and sync. The first ID click now sorts ascending in both cases.
Related to #433 and #476.
Verification
AI Usage Disclosure