Browse Source

fix(new-widget-builder-experience): Order of hooks (#34028)

Nar Saynorath 2 years ago
parent
commit
54ffff9f8c
1 changed files with 10 additions and 10 deletions
  1. 10 10
      static/app/views/dashboardsV2/widgetBuilder/widgetBuilder.tsx

+ 10 - 10
static/app/views/dashboardsV2/widgetBuilder/widgetBuilder.tsx

@@ -945,16 +945,6 @@ function WidgetBuilder({
     return false;
   }
 
-  if (isEditing && !isValidWidgetIndex) {
-    return (
-      <SentryDocumentTitle title={dashboard.title} orgSlug={orgSlug}>
-        <PageContent>
-          <LoadingError message={t('The widget you want to edit was not found.')} />
-        </PageContent>
-      </SentryDocumentTitle>
-    );
-  }
-
   const canAddSearchConditions =
     [DisplayType.LINE, DisplayType.AREA, DisplayType.BAR].includes(state.displayType) &&
     state.queries.length < 3;
@@ -996,6 +986,16 @@ function WidgetBuilder({
     (widgetBuilderNewDesign && isTimeseriesChart && groupByValueSelected) ||
     isTabularChart;
 
+  if (isEditing && !isValidWidgetIndex) {
+    return (
+      <SentryDocumentTitle title={dashboard.title} orgSlug={orgSlug}>
+        <PageContent>
+          <LoadingError message={t('The widget you want to edit was not found.')} />
+        </PageContent>
+      </SentryDocumentTitle>
+    );
+  }
+
   return (
     <SentryDocumentTitle title={dashboard.title} orgSlug={orgSlug}>
       <PageFiltersContainer