Skip to content

fix: Infinite loading when uploaded one harmful content file#416

Merged
Roopan-Microsoft merged 2 commits intodevfrom
psl-navigation-fix
Apr 21, 2026
Merged

fix: Infinite loading when uploaded one harmful content file#416
Roopan-Microsoft merged 2 commits intodevfrom
psl-navigation-fix

Conversation

@Shreyas-Microsoft
Copy link
Copy Markdown
Collaborator

Purpose

This pull request improves the reliability of navigation and completion detection on the ModernizationPage by 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:

  • Added a 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]
  • Improved detection of batch/file completion by checking if all files have terminal statuses (completed, failed, or error), not just the batch status, before enabling navigation and the zip button.

Fallback Handling and State Management:

  • Implemented a fallback polling useEffect that 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).
  • Updated the logic to only reset the completion state (allFilesCompleted) if it hasn't already been finalized, preventing unnecessary state changes.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

Shreyas-Microsoft and others added 2 commits April 14, 2026 16:40
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 Roopan-Microsoft merged commit a59df85 into dev Apr 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants