Просмотр исходного кода

fix(ui): Handle Adoption Stage if project slug invalid (#29227)

* fix(ui): Handle Adoption Stage if project slug invalid

Edge case where project slug isn't valid because of updating the name/slug or deleting the project and not refreshing the page if another tab was opened. Prerviously, this would throw a TypeError and not load the page, so we should still load the page.

FIXES WOR-1388
FIXES JAVASCRIPT-25ND

* refactor: use optional chainging, remove try/catch
Kelly Carino 3 лет назад
Родитель
Сommit
061e10977c
1 измененных файлов с 2 добавлено и 3 удалено
  1. 2 3
      static/app/views/releases/detail/overview/releaseAdoption.tsx

+ 2 - 3
static/app/views/releases/detail/overview/releaseAdoption.tsx

@@ -208,9 +208,8 @@ function ReleaseComparisonChart({
   });
 
   const isMobileProject = isProjectMobileForReleases(project.platform);
-  const adoptionStage = release.adoptionStages?.[project.slug].stage;
-  const adoptionStageLabel =
-    Boolean(adoptionStage) && ADOPTION_STAGE_LABELS[adoptionStage];
+  const adoptionStage = release.adoptionStages?.[project.slug]?.stage;
+  const adoptionStageLabel = ADOPTION_STAGE_LABELS[adoptionStage];
   const multipleEnvironments = environment.length === 0 || environment.length > 1;
 
   return (