Browse Source

fix(crons): Correct assumption that lastCheckIn is never null (#55590)

Fixes JAVASCRIPT-2NRB
Evan Purkhiser 1 year ago
parent
commit
17eafe339d
2 changed files with 3 additions and 4 deletions
  1. 2 3
      static/app/views/monitors/details.tsx
  2. 1 1
      static/app/views/monitors/types.tsx

+ 2 - 3
static/app/views/monitors/details.tsx

@@ -1,6 +1,7 @@
 import {Fragment} from 'react';
 import {RouteComponentProps} from 'react-router';
 import styled from '@emotion/styled';
+import sortBy from 'lodash/sortBy';
 
 import DatePageFilter from 'sentry/components/datePageFilter';
 import * as Layout from 'sentry/components/layouts/thirds';
@@ -76,9 +77,7 @@ function MonitorDetails({params, location}: Props) {
     );
   }
 
-  const envsSortedByLastCheck = monitor.environments.sort((a, b) =>
-    a.lastCheckIn.localeCompare(b.lastCheckIn)
-  );
+  const envsSortedByLastCheck = sortBy(monitor.environments, e => e.lastCheckIn);
 
   return (
     <SentryDocumentTitle title={`Crons — ${monitor.name}`}>

+ 1 - 1
static/app/views/monitors/types.tsx

@@ -71,7 +71,7 @@ export type MonitorConfig = CrontabConfig | IntervalConfig;
 
 export interface MonitorEnvironment {
   dateCreated: string;
-  lastCheckIn: string;
+  lastCheckIn: string | null;
   name: string;
   nextCheckIn: string | null;
   status: MonitorStatus;