diff --git a/src/ui/units/wizard/components/Dialogs/DialogColor/DialogColor.tsx b/src/ui/units/wizard/components/Dialogs/DialogColor/DialogColor.tsx index 199e68dcc6..7d974d64a8 100644 --- a/src/ui/units/wizard/components/Dialogs/DialogColor/DialogColor.tsx +++ b/src/ui/units/wizard/components/Dialogs/DialogColor/DialogColor.tsx @@ -15,13 +15,16 @@ import {ALLOWED_FOR_NULL_MODE_VISUALIZATIONS} from 'ui/units/wizard/constants/di import {setDialogColorPaletteState} from 'units/wizard/actions/dialogColor'; import {selectDataset, selectParameters} from 'units/wizard/selectors/dataset'; import {selectUpdates} from 'units/wizard/selectors/preview'; -import {selectDashboardParameters, selectFilters} from 'units/wizard/selectors/visualization'; +import { + selectDashboardParameters, + selectFilters, + selectVisualization, +} from 'units/wizard/selectors/visualization'; import { isGradientDialog, selectDialogColorGradientState, selectDialogColorPaletteState, - selectDialogColorVisualizationId, } from '../../../selectors/dialogColor'; import ColorSettingsContainer from './ColorSettingsContainer/ColorSettingsContainer'; @@ -90,20 +93,25 @@ class DialogColorComponent extends React.Component { } render() { - const {item, items, dataset, isColorModeChangeAvailable, colorSectionFields} = this.props; + const { + item, + items, + dataset, + isColorModeChangeAvailable, + colorSectionFields, + visualization, + } = this.props; const {mountedColors = {}} = this.props.paletteState; const {validationStatus} = this.props.gradientState; const {colorMode} = this.state; - if (!item || !dataset) { + if (!item || !dataset || !visualization) { return null; } const canSetNullMode = this.props.canSetNullMode && - (ALLOWED_FOR_NULL_MODE_VISUALIZATIONS as (string | undefined)[]).includes( - this.props.visualizationId, - ); + (ALLOWED_FOR_NULL_MODE_VISUALIZATIONS as string[]).includes(visualization.id); return ( @@ -240,7 +248,7 @@ const mapStateToProps = (state: DatalensGlobalState) => { dataset: selectDataset(state), gradientState: selectDialogColorGradientState(state), paletteState: selectDialogColorPaletteState(state), - visualizationId: selectDialogColorVisualizationId(state), + visualization: selectVisualization(state), }; }; diff --git a/src/ui/units/wizard/selectors/dialogColor.ts b/src/ui/units/wizard/selectors/dialogColor.ts index 80cbc6e47a..a0fdee7550 100644 --- a/src/ui/units/wizard/selectors/dialogColor.ts +++ b/src/ui/units/wizard/selectors/dialogColor.ts @@ -17,9 +17,6 @@ export const selectDialogColorPaletteState = (state: DatalensGlobalState) => export const selectDialogColorGradientState = (state: DatalensGlobalState) => state.wizard.dialogColor.gradientState; -export const selectDialogColorVisualizationId = (state: DatalensGlobalState) => - state.wizard.visualization.visualization?.id; - export const selectClientPaletteColors = (state: DatalensGlobalState) => { const {palette} = state.wizard.dialogColor.paletteState; const {colorPalettes} = state.colorPaletteEditor;