mirror of
https://github.com/apache/superset.git
synced 2026-05-21 15:55:10 +00:00
fix(Chart): port master's ErrorInfo typing + semantic-layer databaseName
Carry forward master changes that landed during this PR's lifetime: - #38563 (React 18): handleRenderContainerFailure uses ErrorInfo type and info?.componentStack ?? null instead of the legacy nullable shim. - #37815 (semantic layer): databaseName falls back to datasource?.parent?.name before datasource?.database?.name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { ErrorInfo, useCallback, useEffect, useRef } from 'react';
|
||||
import { t } from '@apache-superset/core/translation';
|
||||
import { logging } from '@apache-superset/core/utils';
|
||||
import {
|
||||
@@ -253,12 +253,12 @@ function Chart({
|
||||
]);
|
||||
|
||||
const handleRenderContainerFailure = useCallback(
|
||||
(error: Error, info: { componentStack: string } | null) => {
|
||||
(error: Error, info: ErrorInfo) => {
|
||||
logging.warn(error);
|
||||
actions.chartRenderingFailed(
|
||||
error.toString(),
|
||||
chartId,
|
||||
info ? info.componentStack : null,
|
||||
info?.componentStack ?? null,
|
||||
);
|
||||
|
||||
actions.logEvent(LOG_ACTIONS_RENDER_CHART, {
|
||||
@@ -421,7 +421,9 @@ function Chart({
|
||||
],
|
||||
);
|
||||
|
||||
const databaseName = datasource?.database?.name as string | undefined;
|
||||
const databaseName =
|
||||
datasource?.parent?.name ??
|
||||
(datasource?.database?.name as string | undefined);
|
||||
|
||||
const isLoading = chartStatus === 'loading';
|
||||
// Suppress spinner during auto-refresh to avoid visual flicker
|
||||
|
||||
Reference in New Issue
Block a user