Skip to content

Commit

Permalink
dropdown fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen committed Jan 14, 2025
1 parent 6d4e1d7 commit 3b956ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions patientsearch/src/js/components/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export default function Dropdown(props) {
<StyledMenu
id="dropdownMenu"
anchorEl={props.anchorEl}
keepMounted
// keepMounted
open={!!props.open}
onClose={(event) => handleMenuClose(event)}
transformOrigin={{
vertical: "top",
horizontal: "center",
horizontal: "left",
}}
elevation={2}
>
Expand Down
12 changes: 3 additions & 9 deletions patientsearch/src/js/context/PatientListContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@ export default function PatientListContextProvider({ children }) {
if (!columns) return [];
return columns.filter((column) => column.searchable);
};
const shouldSearchByField = (fieldname) => {
const fields = getSearchableFields();
return fields.find(
(col) => String(col.field).toLowerCase() === fieldname && !!col.searchable
);
};
const needExternalAPILookup = () => {
return getAppSettingByKey("EXTERNAL_FHIR_API");
};
Expand Down Expand Up @@ -314,7 +308,7 @@ export default function PatientListContextProvider({ children }) {
});
};
const getMenuItems = () => {
return menuItems && menuItems.length
return !isEmptyArray(menuItems)
? menuItems.filter((item) => shouldShowMenuItem(item.id))
: [];
};
Expand Down Expand Up @@ -368,7 +362,7 @@ export default function PatientListContextProvider({ children }) {
};
const shouldShowMenuItem = (id) => {
let arrMenu = getAppSettingByKey(constants.MORE_MENU_KEY);
if (!Array.isArray(arrMenu)) return false;
if (isEmptyArray(arrMenu)) return false;
return (
arrMenu.filter((item) => item.toLowerCase() === id.toLowerCase()).length >
0
Expand Down Expand Up @@ -484,7 +478,7 @@ export default function PatientListContextProvider({ children }) {
if (!Array.isArray(data)) {
data = [data];
}
return data && Array.isArray(data)
return !isEmptyArray(data)
? data.map((item) => {
const source = item.resource ? item.resource : item;
const cols = getColumns();
Expand Down

0 comments on commit 3b956ab

Please sign in to comment.