aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoubrid Ihab <boubrid.ihab@gmail.com>2022-05-23 19:00:59 +0100
committerBoubrid Ihab <boubrid.ihab@gmail.com>2022-05-23 19:00:59 +0100
commit37a55dacdab9be41a6d39473ac2922b9875cefe9 (patch)
tree35e9a1eebfcc14e2082cd6fe52ffc042ec1f08e9
parentd377612dcd3920713ea083e5fa59dd7f94e52ad5 (diff)
downloadtrackermap-web-37a55dacdab9be41a6d39473ac2922b9875cefe9.tar.gz
trackermap-web-37a55dacdab9be41a6d39473ac2922b9875cefe9.tar.bz2
trackermap-web-37a55dacdab9be41a6d39473ac2922b9875cefe9.zip
fix:generate unique key to index items on SummaryReport based on deviceId & startTime
-rw-r--r--modern/src/reports/SummaryReportPage.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js
index 56e4c7ed..8bf03a9a 100644
--- a/modern/src/reports/SummaryReportPage.js
+++ b/modern/src/reports/SummaryReportPage.js
@@ -76,6 +76,9 @@ const SummaryReportPage = () => {
return item[key];
}
};
+ const generateKey = (item) => {
+ return `${ item.deviceId }_${Date.parse(item.startTime)}`;
+ }
return (
<PageLayout menu={<ReportsMenu />} breadcrumbs={['reportTitle', 'reportSummary']}>
<ReportFilter handleSubmit={handleSubmit}>
@@ -99,7 +102,7 @@ const SummaryReportPage = () => {
</TableHead>
<TableBody>
{items.map((item) => (
- <TableRow key={item.deviceId}>
+ <TableRow key={generateKey(item)}>
{columns.map((key) => (
<TableCell key={key}>
{formatValue(item, key)}