Skip to content

[WEB-4592] Fix patient list stale-overwrite race under slow network - #1929

Merged
clintonium-119 merged 2 commits into
release-1.95.3from
stale-filter-fix
May 19, 2026
Merged

[WEB-4592] Fix patient list stale-overwrite race under slow network#1929
clintonium-119 merged 2 commits into
release-1.95.3from
stale-filter-fix

Conversation

@clintonium-119

@clintonium-119 clintonium-119 commented May 19, 2026

Copy link
Copy Markdown
Member

WEB-4592 Fix patient list stale-overwrite race under slow network

When multiple fetchPatientsForClinic dispatches are in flight
simultaneously, an older response arriving last would overwrite the
newer one's correctly-filtered result, then flipping to the unfiltered
set.

When multiple fetchPatientsForClinic dispatches are in flight
simultaneously, an older response arriving last would overwrite the
newer one's correctly-filtered result, then flipping to the unfiltered
set.
@clintonium-119
clintonium-119 requested a review from Copilot May 19, 2026 23:04
@clintonium-119 clintonium-119 changed the title [WEB-4592] Stale filter fix [WEB-4592] Fix patient list stale-overwrite race under slow network May 19, 2026
@clintonium-119
clintonium-119 requested a review from henry-tp May 19, 2026 23:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a stale-overwrite race in the clinic patients fetch flow by ensuring that when multiple fetchPatientsForClinic requests are in flight, only the most recently-dispatched request is allowed to update Redux state.

Changes:

  • Add a monotonic request sequence guard to fetchPatientsForClinic to ignore stale success/failure callbacks.
  • Add unit tests covering stale success and stale failure response abandonment behavior.
  • Bump package version from 1.95.3-rc.1 to 1.95.3-rc.2.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
app/redux/actions/async.js Introduces a request sequence counter to abandon stale getPatientsForClinic responses.
test/unit/redux/actions/async.test.js Adds regression tests ensuring stale responses don’t dispatch SUCCESS/FAILURE.
package.json Increments release candidate version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@henry-tp henry-tp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of the counter method but it resolves the issue we have for now and I can't come up with an immediate alternative. We should make an effort to move to the fetching away from platform-client as soon as we can.

@clintonium-119
clintonium-119 merged commit 9290bb1 into release-1.95.3 May 19, 2026
3 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.

3 participants