- {dashboardViewport?.current &&
- dashboardContainer &&
- !isErrorEmbeddable(dashboardContainer) && (
-
- )}
- {renderDashboardContents()}
-
- );
- }
-);
+ // Disabling exhaustive deps because embeddable should only be created on first render.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [savedObjectId]);
+
+ useUnmount(() => {
+ fatalError?.destroy();
+ dashboardContainer?.destroy();
+ });
+
+ const viewportClasses = classNames(
+ 'dashboardViewport',
+ { 'dashboardViewport--screenshotMode': screenshotMode },
+ { 'dashboardViewport--loading': loading }
+ );
+
+ const loadingSpinner = showPlainSpinner ? (
+
+ {dashboardViewport?.current &&
+ dashboardContainer &&
+ !isErrorEmbeddable(dashboardContainer) && (
+
+ )}
+ {renderDashboardContents()}
+
+ );
+}
/**
* Maximizing a panel in Dashboard only works if the parent div has a certain class. This
@@ -202,13 +179,13 @@ export const DashboardRenderer = forwardRef