Skip to content

TSA-328: [Bug] Document page: Pause button flickers Resume-Pause-Resume when clicked on a slow connection right as a poll request lands - #345

Merged
Yehor-Makarenko merged 15 commits into
mainfrom
fix/TSA-328-status-flicking-after-pause
Sep 23, 2026
Merged

Yehor-Makarenko merged 15 commits into
mainfrom
fix/TSA-328-status-flicking-after-pause

Conversation

@Yehor-Makarenko

Copy link
Copy Markdown
Collaborator

Closes #328

1. Fixed UI Flickering on Pause Action

Issue:
When the user clicks the Pause button while a progress-polling request is already in-flight, the stale response from the poll (returning processing status) arrives after the click and temporarily overwrites the optimistic UI state. Once the pause mutation resolves, the UI corrects itself back to paused. This causes a jarring visual flicker where the control jumps between Resume and Pause states.

Solution:

  • Added a check on the client side to skip document status updates from polling responses when the current status is PAUSED.
  • Guaranteed that optimistic state updates and completed manual actions take precedence over outdated background polling responses.

2. Resolved Resume Action Failure on Out-of-Sync Document States

Issue (Discovered during testing):
If a document transitioned to a non-pausable state (e.g., done or budget_stop) on the backend while paused, clicking Resume was repeatedly throwing a server-side error. This occurred because the backend strict-checked for document.status === DocumentStatus.PAUSE, rejecting the request.

Solution:

  • Updated the Resume backend handler logic to prevent throwing an unhandled error when the document status is no longer PAUSED.
  • Ensured the Resume endpoint returns the updated document object, allowing the client side to immediately synch and reflect the actual backend status without breaking the UI flow.

How to Verify

  1. Flicker Fix: Throttle network to Slow 3G on a processing document page. Trigger a poll, quickly click Pause, and verify the control smoothly transitions to Resume without briefly flipping back to Pause.
  2. Resume Error Fix: Simulate/set a paused document to done or budget_stop state, click Resume, and verify that no server error is thrown and the client UI updates immediately with the fresh document state.

@Yehor-Makarenko Yehor-Makarenko added this to the transcripta-release-3 milestone Sep 21, 2026
@Yehor-Makarenko Yehor-Makarenko self-assigned this Sep 21, 2026
@Yehor-Makarenko Yehor-Makarenko added bug Something isn't working backend Backend application feature New feature (auto-applied by the feature template) labels Sep 21, 2026
Comment thread apps/frontend/src/modules/documents/slices/documents.slice.ts Outdated
@arturobdev
arturobdev self-requested a review September 22, 2026 00:53
@Yehor-Makarenko
Yehor-Makarenko merged commit 4b87e6a into main Sep 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend application bug Something isn't working feature New feature (auto-applied by the feature template)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug] Document page: Pause button flickers Resume-Pause-Resume when clicked on a slow connection right as a poll request lands

4 participants