diff --git a/package.json b/package.json index a97ff745..e99e0492 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pd-live-react", "homepage": "https://pagerduty.github.io/pd-live-react", - "version": "0.13.1-beta.0", + "version": "0.13.2-beta.0", "private": true, "dependencies": { "@chakra-ui/icons": "^2.1.1", diff --git a/src/config/version.js b/src/config/version.js index aa9311bf..a2e84652 100644 --- a/src/config/version.js +++ b/src/config/version.js @@ -1,2 +1,2 @@ // Generated by genversion. -export const version = '0.13.1-beta.0'; +export const version = '0.13.2-beta.0'; diff --git a/src/redux/incidents/sagas.js b/src/redux/incidents/sagas.js index 81f792af..3c492ee4 100644 --- a/src/redux/incidents/sagas.js +++ b/src/redux/incidents/sagas.js @@ -107,7 +107,7 @@ export function* getIncidentsImpl() { until, include: ['first_trigger_log_entries', 'external_references'], limit: INCIDENTS_PAGINATION_LIMIT, - sort_by: 'created_at:desc', + sort_by: 'incident_number:desc', }; if (incidentStatus) baseParams.statuses = incidentStatus; @@ -129,6 +129,17 @@ export function* getIncidentsImpl() { connectionStatusMessage: 'Unable to fetch incidents', }); } + // The incident list API may return duplicate incidents under some circumstances, so as a precaution we'll dedupe the list by incident.id + // Also log a RUM error if we find any duplicates + const duplicateIncidents = incidents.filter((incident, index, self) => self.findIndex((t) => t.id === incident.id) !== index); + const numDuplicateIncidents = duplicateIncidents.length; + if (numDuplicateIncidents > 0) { + // eslint-disable-next-line no-console + console.error('Duplicate incidents found', numDuplicateIncidents); + RealUserMonitoring.trackError(new Error('Duplicate incidents found'), numDuplicateIncidents); + incidents = incidents.filter((incident, index, self) => self.findIndex((t) => t.id === incident.id) === index); + } + return incidents; }