-
Notifications
You must be signed in to change notification settings - Fork 251
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
(feat) O3-4398 : add new mutate lab orders prop to enable workspace callers to correctly mutate data #2225
Open
amosmachora
wants to merge
3
commits into
openmrs:main
Choose a base branch
from
amosmachora:fix/broken-lab-results-mutate-functionality
base: main
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
(feat) O3-4398 : add new mutate lab orders prop to enable workspace callers to correctly mutate data #2225
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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.
The current implementation of the mutateLabOrders callback appears to serve two purposes simultaneously:
test-results-form-workspace
workspace.Is this dual responsibility intentional? Given that we're already operating within the workspace context when invoking this form, should the workspace launch be considered a separate concern from the data revalidation?
If so, consider separating these concerns by:
This would better align with the Single Responsibility Principle and prevent workspace re-launching from within an already active workspace context.
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.
I've left this additional comment that should clarify what I meant above.
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.
I've also tested this out locally and I don't see how the
Add lab results
button in the Laboratory app is related to theAdd results
button in the Orders app.Your other PR adds a mutate function that gets passed down to the workspace when you launch the Lab results form by clicking the Add lab results button in the Laboratory app.
On the other hand, the Add results button in the Orders table in Patient Chart has a different handler altogether.
Could you help shed some light on that, @amosmachora?
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.
The two buttons are not related at all. They all launch the same workspace on their click handlers but from different places in the app.
That's why I wouldn't want to couple the
mutateLabOrders
functionality to the workspace itself and would like it to remain agnostic and have what it needs be passed down as an optional prop. I am not sure I am answering your question.Do you think they should use the same handler?
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.
So the thing is, AFAICT, even if you pass
mutateLabOrders
down as a prop to the workspace, it only gets passed to the workspace that gets launched from clicking theAdd lab results
button in the Lab app.Adding it as a prop to the orders app doesn't work because the logic that triggers launching that workspace has no knowledge of the
mutateLabOrders
prop.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.
Isn't that what we want? I think that was essentially what I was trying to achieve to find a way for whatever caller to pass a mutate function and have it just work. This was essential in the lab since it allowed for the mutation of lab orders rendered as rows. if for example in the orders app, a need would arise to mutate something (highly unlikely) they would pass a prop and it would just work.
Now that I think of it maybe the prop could be named more generically like
mutate
.that's why I made it optional since it is very specific to the lab workspace and no other workspace instance.
Does this feel like a hack? Any better ideas