-
Notifications
You must be signed in to change notification settings - Fork 3
BN-47 | Add. Patient Allergies Display Control #7
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
Conversation
| const { allergies, loading, error } = useAllergies(patientUUID); | ||
|
|
||
| // Define table headers | ||
| const headers = useMemo( |
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.
What is the need for useMemo here ? this is a simple constant with no calculation involved
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.
If you defined the headers array directly in the render function (i.e., without useMemo), a new array reference would be created on every render. Even though the contents are the same, React (or child components) may interpret the new reference as a change — especially if the child component (like ExpandableDataTable) is using React.memo() or does deep equality checks to avoid re-renders.
src/__mocks__/allergyMocks.ts
Outdated
| import { | ||
| FhirAllergyIntolerance, | ||
| FhirAllergyIntoleranceBundle, | ||
| } from '../types/allergy'; |
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.
Can we not use @types ??
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.
Here we should, missed it.
| import React, { useMemo } from 'react'; | ||
| import { Tag } from '@carbon/react'; | ||
| import { ExpandableDataTable } from '../../components/expandableDataTable/ExpandableDataTable'; | ||
| import { usePatientUUID } from '../../hooks/usePatientUUID'; |
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.
Shouldn't all the following imports use alias ?
| @@ -0,0 +1,283 @@ | |||
| import React from 'react'; | |||
| import { renderHook, act, waitFor } from '@testing-library/react'; | |||
| import { useAllergies } from '../useAllergies'; | |||
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.
Use @hooks ?
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.
Since this a test for useAllergies available in the same sub folder, using an alias is an overkill.
| * @param delimiters - Optional string of delimiter characters (default: " -", space and hyphen) | ||
| * @returns The string in capital case | ||
| */ | ||
| export function capitalize(input: string, delimiters: string = ' -'): string { |
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.
Captialize is confusing. The result of this function is sentenceCase not capitalCase. Can we think of a better method naming ?
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 result of the function would be "Foo Bar" for an input of "foo bar". Sentence case is when only the first character is in uppercase and the rest is all in lower (eg- "Foo bar").
JIRA -> BN-47
This PR adds functionality to display a patient's allergies on the dashboard, ensuring all allergies are clearly presented with relevant details.
Key Features
Implementation Details
Next Steps