fix(list): 🐛 Prevent cloud task progress regression on page navigation#66
Merged
Conversation
… remount The previous Math.max merge was ineffective because prevData is empty when the List component remounts (after navigation). This fix introduces a module-level cloudProgressCache that persists across mount/unmount cycles, ensuring SSE-driven progress is never lost when fetchTasks returns stale API data. - Cache is updated on every SSE event (page_completed, completed, etc.) - fetchTasks merges API data with both React state AND the cache - Cache entries are cleaned up when tasks reach terminal states
AI Code Review SummaryPR: #66 (fix(list): 🐛 Prevent cloud task progress regression on page navigation) Overall AssessmentNo blocking issue was detected in the reviewed diff; keep focused regression testing before merge. Major Findings by SeverityNo major issues identified from the reviewed diff. Actionable Suggestions
Potential Risks
Test Suggestions
File-Level Coverage Notes
Inline Downgraded Items (processed but not inline)
Coverage Status
Uncovered list:
No-patch covered list:
Runtime/Budget
Reasons:
|
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.
Summary
cloudProgressCachethat persists across component mount/unmount cyclesMath.maxto prevent regressionRoot Cause
When navigating away from and back to the task list, the List component remounts with empty state.
fetchTasksthen returns cloud API data with stalepages_completed(due to server write latency), causing progress to jump back to 0%. SSE events that previously updated progress are lost because React state resets on unmount.Solution
A module-level Map (
cloudProgressCache) stores SSE-driven progress updates outside the React lifecycle. On everyfetchTaskscall, the merge logic takes the maximum of three sources: API data, current React state, and the persistent cache.Test Plan
🤖 Generated with TiyCode