Skip to content

Commit

Permalink
fix: drug info changes order after saving
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgamache committed Oct 22, 2024
1 parent d43e31c commit 0722219
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ export const CreateAnimalOutcome: FC<props> = ({ index, assignedOfficer: officer
const { drugs: source } = data;

const items = source.filter(({ id }) => id !== drug.id);
const update = [...items, drug];
const update = from([...items, drug])
.orderBy((item) => item.order)
.toArray();

updateModel("drugs", update);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
const { drugs: source } = data;

const items = source.filter(({ id }) => id !== drug.id);
const update = [...items, drug];
const update = from([...items, drug])
.orderBy((item) => item.order)
.toArray();

updateModel("drugs", update);
};
Expand Down

0 comments on commit 0722219

Please sign in to comment.