diff --git a/app/features/scanner/components/EventFeed.tsx b/app/features/scanner/components/EventFeed.tsx index a249734d3..f68a0cc60 100644 --- a/app/features/scanner/components/EventFeed.tsx +++ b/app/features/scanner/components/EventFeed.tsx @@ -55,6 +55,7 @@ export function EventFeed({ ], R.sortBy([R.prop("t"), "desc"]), R.take(FEED_LENGTH), + withUniqueKeys, ); return ( @@ -63,7 +64,7 @@ export function EventFeed({
  • Waiting for the first read…
  • ) : ( items.map((item) => ( -
  • +
  • @@ -78,6 +79,17 @@ export function EventFeed({ ); } +/** `t` is whole seconds, so e.g. a double splat shares type and `t` */ +function withUniqueKeys(items: FeedItem[]) { + const seen = new Map(); + return items.map((item) => { + const base = `${item.type}-${item.t}-${item.label}`; + const count = seen.get(base) ?? 0; + seen.set(base, count + 1); + return { ...item, key: `${base}-${count}` }; + }); +} + function eventLabel(event: ScanEvent): string | null { switch (event.type) { case MAP_START_EVENT_TYPE: {