[Dashboard] Switch to using the correct actor ID as a react key for each actor entry in the actors list in the logical view. This fixes a bug where duplicate actor entries were being rendered in the UI (#9991)

Co-authored-by: Max Fitton <max@semprehealth.com>
This commit is contained in:
Max Fitton
2020-08-07 20:46:06 -07:00
committed by GitHub
parent a438cbd1e8
commit d9822e04d4
@@ -8,8 +8,8 @@ type ActorProps = {
const Actors = (props: ActorProps) => {
const { actors } = props;
const actorChildren = Object.values(actors)
.sort((actor1, actor2) => {
const actorChildren = Object.entries(actors)
.sort(([, actor1], [, actor2]) => {
if (
actor1.state === ActorState.Dead &&
actor2.state === ActorState.Dead
@@ -21,7 +21,7 @@ const Actors = (props: ActorProps) => {
return 1;
}
})
.map((actor) => <Actor actor={actor} key={actor.actorId} />);
.map(([aid, actor]) => <Actor actor={actor} key={aid} />);
return <Fragment>{actorChildren}</Fragment>;
};