From d3d16a2442d536443eb8185b6f82078e05ba3369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20R=C3=A4ntil=C3=A4?= Date: Fri, 14 Jan 2022 16:28:28 +0100 Subject: [PATCH] fix(cicd-statistics): Don't instanceof, do fuzzy matching for better compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gustaf Räntilä --- plugins/cicd-statistics/src/apis/types.ts | 2 +- plugins/cicd-statistics/src/entity-page.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/cicd-statistics/src/apis/types.ts b/plugins/cicd-statistics/src/apis/types.ts index 5392657a64..48cb58e350 100644 --- a/plugins/cicd-statistics/src/apis/types.ts +++ b/plugins/cicd-statistics/src/apis/types.ts @@ -163,7 +163,7 @@ export interface CicdConfiguration { /** * If the Api implements support for aborting the fetching of builds, throw an - * AbortError of this type + * AbortError of this type (or any other error with name === 'AbortError'). */ export class AbortError extends Error {} diff --git a/plugins/cicd-statistics/src/entity-page.tsx b/plugins/cicd-statistics/src/entity-page.tsx index d339f52fde..28c08f2371 100644 --- a/plugins/cicd-statistics/src/entity-page.tsx +++ b/plugins/cicd-statistics/src/entity-page.tsx @@ -35,7 +35,7 @@ import { getDefaultViewOptions, ViewOptions, } from './components/chart-filters'; -import { AbortError, CicdConfiguration } from './apis'; +import { CicdConfiguration } from './apis'; import { cleanupBuildTree } from './utils/stage-names'; import { renderFallbacks, useAsyncChain } from './components/progress'; @@ -131,7 +131,7 @@ function CicdCharts(props: CicdChartsProps) { useEffect(() => { if ( !chartableStagesState.error || - chartableStagesState.error instanceof AbortError + chartableStagesState.error?.name === 'AbortError' ) { return; }