File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
frontend/src/app/components Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,10 @@ export const ChartEditor: React.FC<ChartEditorProps> = ({
113113
114114 useMount (
115115 ( ) => {
116- if ( ! dataChartId && ! originChart ) {
116+ if (
117+ ( container === 'dataChart' && ! dataChartId ) ||
118+ ( container === 'widget' && ! originChart )
119+ ) {
117120 // Note: add default chart if new to editor
118121 const currentChart = ChartManager . instance ( ) . getDefaultChart ( ) ;
119122 handleChartChange ( currentChart ) ;
@@ -135,6 +138,7 @@ export const ChartEditor: React.FC<ChartEditorProps> = ({
135138 backendChart : originChart as ChartDTO ,
136139 } ) ,
137140 ) ;
141+
138142 if ( ! originChart ) {
139143 dispatch ( actions . updateChartAggregation ( true ) ) ;
140144 }
@@ -201,7 +205,9 @@ export const ChartEditor: React.FC<ChartEditorProps> = ({
201205 ) ;
202206
203207 const clearDataConfig = useCallback ( ( ) => {
204- const currentChart = ChartManager . instance ( ) . getById ( chart ?. meta ?. id ) ;
208+ const currentChart = chart ?. meta ?. id
209+ ? ChartManager . instance ( ) . getById ( chart ?. meta ?. id )
210+ : ChartManager . instance ( ) . getDefaultChart ( ) ;
205211 let targetChartConfig = CloneValueDeep ( currentChart ?. config ) ;
206212 registerChartEvents ( currentChart ) ;
207213 setChart ( currentChart ) ;
You can’t perform that action at this time.
0 commit comments