-
Notifications
You must be signed in to change notification settings - Fork 532
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
Medication Request | Convert dosage instruction to array #9665
Changes from all commits
bf83af8
d396a76
b70cd3a
23af6b1
bdc50ab
486a660
5b3fa6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,9 +145,9 @@ export default function MedicineAdministrationTableRow({ | |
</span> | ||
)} | ||
|
||
{prescription.dosage_instruction.route && ( | ||
{prescription.dosage_instruction[0].route && ( | ||
<span className="hidden rounded-full border border-blue-500 bg-blue-100 px-1.5 text-xs font-medium text-blue-700 lg:block"> | ||
{displayCode(prescription.dosage_instruction.route)} | ||
{displayCode(prescription.dosage_instruction[0].route)} | ||
</span> | ||
)} | ||
</div> | ||
|
@@ -217,7 +217,7 @@ type DosageFrequencyInfoProps = { | |
export function DosageFrequencyInfo({ | ||
prescription, | ||
}: DosageFrequencyInfoProps) { | ||
const dosageInstruction = prescription.dosage_instruction; | ||
const dosageInstruction = prescription.dosage_instruction[0]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add null-check for dosage_instruction array In - const dosageInstruction = prescription.dosage_instruction[0];
+ const dosageInstruction = prescription.dosage_instruction?.[0];
+ if (!dosageInstruction) {
+ return null; // or a placeholder
+ }
|
||
|
||
return ( | ||
<div className="flex justify-center"> | ||
|
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.
🛠️ Refactor suggestion
Safely access prescription.dosage_instruction[0].route
As with other components, ensure that the
dosage_instruction
array is not empty before accessing[0]
.📝 Committable suggestion