Skip to content
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): Added Error Handling cases in patient-list-details #1763

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

This file was deleted.

Expand Up @@ -35,6 +35,10 @@ const PatientListDetailsTable: React.FC<PatientListDetailsTableProps> = ({ listM
const [searchTerm, setSearchTerm] = useState('');
const debouncedSearchTerm = useDebounce(searchTerm);

if (!listMembers) {
return null; // or return a loading indicator or placeholder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An isLoading condition below renders a loading skeleton. Error states are handled using the ErrorState component.

}

const tableHeaders: Array<typeof DataTableHeader> = useMemo(
() => [
{
Expand Down
Expand Up @@ -20,6 +20,10 @@ function PatientListDetailsWorkspace({ list }: PatientListDetailsWorkspaceProps)
launchPatientWorkspace('patient-lists');
}, []);

if (!listMembers) {
return null; // or return a loading indicator or placeholder
}

return (
<main className={styles.container}>
<section className={styles.header}>
Expand Down
Expand Up @@ -63,7 +63,7 @@ function PatientListsWorkspace() {
extract: (list) => `${list.name} ${list.type}`,
})
.sort((r1, r2) => r1.score - r2.score)
.map((result) => result.original)
.map((result) => (result ? result.original : null))
: patientLists;
}, [debouncedSearchTerm, patientLists]);

Expand Down Expand Up @@ -118,6 +118,8 @@ function PatientListsWorkspace() {
{rows.map((row) => {
const currentList = patientLists?.find((list) => list?.id === row.id);

if (!currentList) return null;

return (
<TableRow {...getRowProps({ row })} key={row.id}>
<TableCell>
Expand Down