address review: drop redundant useTheme + theme prop in StatefulChart

SuperChart is exported via withTheme(...), so the theme flows in from
context automatically. The explicit useTheme() call and theme={theme}
prop are redundant, and the cast on useTheme from @emotion/react
(rather than the guarded @apache-superset/core/theme hook) was an
unnecessary type workaround.
This commit is contained in:
Evan Rusackas
2026-04-22 13:55:41 -07:00
parent a9771609c3
commit e4eb0fc33d

View File

@@ -20,7 +20,6 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import { ParentSize } from '@visx/responsive';
import { t } from '@apache-superset/core/translation';
import { useTheme } from '@emotion/react';
import {
QueryFormData,
QueryData,
@@ -35,7 +34,7 @@ import getChartBuildQueryRegistry from '../registries/ChartBuildQueryRegistrySin
import getChartMetadataRegistry from '../registries/ChartMetadataRegistrySingleton';
import getChartControlPanelRegistry from '../registries/ChartControlPanelRegistrySingleton';
import SuperChart from './SuperChart';
import { SupersetTheme } from '@apache-superset/core/theme';
// Using more specific states that align with chart loading process
type LoadingState = 'uninitialized' | 'loading' | 'loaded' | 'error';
@@ -186,8 +185,6 @@ export default function StatefulChart(props: StatefulChartProps) {
const [error, setError] = useState<Error>();
const [formData, setFormData] = useState<QueryFormData>();
const theme = useTheme() as SupersetTheme;
const chartClientRef = useRef<ChartClient>();
const abortControllerRef = useRef<AbortController>();
@@ -487,7 +484,6 @@ export default function StatefulChart(props: StatefulChartProps) {
onRenderSuccess={onRenderSuccess}
onRenderFailure={onRenderFailure}
hooks={hooks}
theme={theme}
/>
);