Bug fix after delete last wo marker entry is updating same rating

This commit is contained in:
vipeeshpavithran 2023-09-14 15:12:58 +05:30
parent 98df5a2825
commit 18a31e4c2a

View File

@ -41,9 +41,11 @@ const PatientImageMarker = (props: Props) => {
};
useEffect(() => {
if (action.type === 'add')
setEntries([...entries, { index: entries.length + 1, severity: 5 }]);
else
if (action.type === 'add') {
const ind =
entries.length != 0 ? entries[entries.length - 1].index + 1 : 1;
setEntries([...entries, { index: ind, severity: 5 }]);
} else
setEntries(
entries.filter((entry: any, ind: number) => ind != action.index)
);