Skip to content

Commit 56c2a93

Browse files
fix(service-incidents): Find incidents with components in updates (#102412)
1 parent a21c371 commit 56c2a93

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

static/app/types/system.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,6 @@ interface StatusPageAffectedComponent {
368368
}
369369

370370
export interface StatusPageIncidentUpdate {
371-
/**
372-
* Components affected by the update
373-
*/
374-
affected_components: StatusPageAffectedComponent[];
375371
/**
376372
* Message to display for this update
377373
*/
@@ -400,6 +396,10 @@ export interface StatusPageIncidentUpdate {
400396
* ISO Update update time
401397
*/
402398
updated_at: string;
399+
/**
400+
* Components affected by the update
401+
*/
402+
affected_components?: StatusPageAffectedComponent[];
403403
}
404404

405405
// See: https://doers.statuspage.io/api/v2/incidents/

static/app/utils/useServiceIncidents.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ export function useServiceIncidents({
6666
}
6767
if (componentFilter) {
6868
filteredIncidents =
69-
incidents?.filter(inc =>
70-
inc.components.some(comp => componentFilter.includes(comp.id))
69+
incidents?.filter(
70+
inc =>
71+
// Find incidents that include any of the componentFilter
72+
inc.components.some(c => componentFilter.includes(c.id)) ||
73+
// Find any incident with an update that includes any of the componentFilter.
74+
inc.incident_updates.some(update =>
75+
update.affected_components?.some(c => componentFilter.includes(c.code))
76+
)
7177
) ?? null;
7278
}
7379

0 commit comments

Comments
 (0)