mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
chore: Restructure explore redux state (#20448)
* chore: Restructure explore redux state * fixes * fix tests * add new tests * Fix type * Address comments * Fix bug * Fix import * Add new test * Move unsaved chart id to a constant * Add todo
This commit is contained in:
committed by
GitHub
parent
20163361b9
commit
c7f1c7d5bd
@@ -24,7 +24,7 @@ import { Menu } from 'src/components/Menu';
|
||||
import ModalTrigger from 'src/components/ModalTrigger';
|
||||
import Button from 'src/components/Button';
|
||||
import { useToasts } from 'src/components/MessageToasts/withToasts';
|
||||
import { exportChart } from 'src/explore/exploreUtils';
|
||||
import { exportChart, getChartKey } from 'src/explore/exploreUtils';
|
||||
import downloadAsImage from 'src/utils/downloadAsImage';
|
||||
import { getChartPermalink } from 'src/utils/urlUtils';
|
||||
import copyTextToClipboard from 'src/utils/copy';
|
||||
@@ -102,17 +102,9 @@ export const useExploreAdditionalActionsMenu = (
|
||||
const [showReportSubMenu, setShowReportSubMenu] = useState(null);
|
||||
const [isDropdownVisible, setIsDropdownVisible] = useState(false);
|
||||
const [openSubmenus, setOpenSubmenus] = useState([]);
|
||||
const charts = useSelector(state => state.charts);
|
||||
const chart = useMemo(() => {
|
||||
if (!charts) {
|
||||
return undefined;
|
||||
}
|
||||
const chartsValues = Object.values(charts);
|
||||
if (chartsValues.length > 0) {
|
||||
return chartsValues[0];
|
||||
}
|
||||
return undefined;
|
||||
}, [charts]);
|
||||
const chart = useSelector(
|
||||
state => state.charts?.[getChartKey(state.explore)],
|
||||
);
|
||||
|
||||
const { datasource } = latestQueryFormData;
|
||||
const sqlSupported = datasource && datasource.split('__')[1] === 'table';
|
||||
|
||||
Reference in New Issue
Block a user