-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Duplicate network requests in Patient Details page #9297
Open
Mahendar0701
wants to merge
23
commits into
ohcnetwork:develop
Choose a base branch
from
Mahendar0701:duplicate-network-requests
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
f4ea6de
removed duplicate network calls
Mahendar0701 dd6ac7c
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 840bf17
policy api after getpatientapi
Mahendar0701 bdcdc06
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 226d59a
updated path
Mahendar0701 fd59300
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 bd24fa2
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 fd32a75
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 50b364a
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 cdbf6f8
updated prefetch and added absolute imports
Mahendar0701 e533aad
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 f4a9851
added absolute imports
Mahendar0701 18d9bbd
added absolute imports
Mahendar0701 5fd96c3
added absolute imports
Mahendar0701 d8d900e
added absolute imports
Mahendar0701 a229ddc
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 9f430f4
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 ec25eea
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 3d49cc2
Merge branch 'develop' into duplicate-network-requests
Mahendar0701 7a278ba
resolved merge conflicts
Mahendar0701 be36557
demography tab api
Mahendar0701 7c87e18
updated imports
Mahendar0701 a3f5353
updated encounter history
Mahendar0701 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why disable prefetch? wouldn't
patientData.id
always be present?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
PatientHome.tsx
, the getPatient API fetchespatientData
and passes it toDemography
as prop.Earlier, I disabled
prefetch
for the insuranceDetails API in Demography to avoid calls with an undefinedpatientData.id
.Now, by setting prefetch to !!patientData.id in the query itself, the API triggers only when the
patientData.id
is available,This prevents unnecessary call.This change working correctly. Please confirm if this correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can get the patient id using the
useSlug
or by passing it as a prop right? We can prevent request waterfalls this way. There's no reason for fetching insurance details to wait until we get the patient object right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i will check it .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we are passing patient id as prop from PatientHome.tsx. This patient id is fetched from getPatient api request.
But the tabs are rendered before the fetching is completed and props are passed as undefined to demography tab.
So to prevent this i have made fetching insurance details to wait until we get the property fetched patient object.
Instead of this should i write a conditional statement in patienthome.tsx so that tabs are not rendered until patientdata is fetched completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get the patient ID from the URL right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes