fix: Infinite loading when uploaded one harmful content file#416
Merged
Roopan-Microsoft merged 2 commits intodevfrom Apr 21, 2026
Merged
fix: Infinite loading when uploaded one harmful content file#416Roopan-Microsoft merged 2 commits intodevfrom
Roopan-Microsoft merged 2 commits intodevfrom
Conversation
When all uploaded files contain harmful content, the backend processes them very fast (before WebSocket connects), causing the UI to get stuck loading indefinitely. This fix: - Detects already-completed batches on initial fetch and navigates directly - Checks both batch status and individual file terminal states - Adds navigation guard (useRef) to prevent duplicate navigations - Prevents resetting allFilesCompleted state after it's been finalized Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The initial fix only handled the case where processing was already complete on initial page load. This adds a 5-second polling fallback that re-fetches batch summary to detect completion when WebSocket events are missed (e.g., all harmful content files processed before WebSocket connected). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Roopan-Microsoft
approved these changes
Apr 21, 2026
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.
Purpose
This pull request improves the reliability of navigation and completion detection on the
ModernizationPageby ensuring users are redirected to the batch view as soon as all files reach a terminal state, even if WebSocket events are missed. It introduces a fallback polling mechanism, prevents duplicate navigation, and refines how completion is detected.Navigation and Completion Detection Improvements:
useRef(hasNavigatedRef) to prevent duplicate navigation to the batch view page when all files or the batch reach a terminal state. Navigation now only occurs once, even if multiple triggers fire. [1] [2] [3] [4]completed,failed, orerror), not just the batch status, before enabling navigation and the zip button.Fallback Handling and State Management:
useEffectthat periodically fetches the batch summary every 5 seconds, ensuring navigation occurs even if WebSocket events are missed (e.g., all files are processed before the WebSocket connects).allFilesCompleted) if it hasn't already been finalized, preventing unnecessary state changes.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information