fix(fde): document and propose solution for patient context loss after registration #216
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
This PR documents an issue observed in the Fast Data Entry (FDE) workflow where the patient context is temporarily lost immediately after patient registration, leading to workflow reinitialization and, in some cases, interrupted form submission.
The purpose of this PR is exploratory and consultative:
Problem Description
During the Fast Data Entry workflow with patient registration:
A new patient is successfully created.
The application navigates back to the form route with patientUuid present in the URL.
Before the workflow state stabilizes:
This triggers workflow initialization again, causing:
temporary loss of patient context
workflow reset during an active session
Shortly after, the patient context recovers, but the workflow has already passed through an inconsistent intermediate state.
This behavior is reproducible and occurs specifically during the post-registration transition.
Observations
Proposed Direction (for Discussion)
Based on these observations, a potential solution could involve:
Alternatively, temporarily treating patientUuid from the URL as authoritative during initialization
These ideas are presented for discussion only and are not enforced in this PR.
What This PR Does
What This PR Does Not Do
Testing Performed
Request for Feedback
Before proceeding with a behavioral fix, I would appreciate guidance on:
Whether delaying workflow initialization aligns with intended FDE design
Whether patientUuid from the URL should be used as a temporary source of truth
Any preferred patterns already used in the codebase for handling similar timing issues
I’m happy to follow up with a focused fix once the direction is confirmed.
Thank you for reviewing, and I appreciate any feedback or suggestions.