@@ -6,7 +6,6 @@ import cloneDeep from 'lodash.clonedeep'
66import { reverseOfLegendSuppressionUpdate } from 'dvc/src/plots/vega/util'
77import styles from './styles.module.scss'
88import { getThemeValue , ThemeProperty } from '../../util/styles'
9- import { useMutationObserver } from '../hooks/useMutationObserver'
109import { exportPlotData } from '../util/messages'
1110
1211type ZoomedInPlotProps = {
@@ -29,14 +28,8 @@ export const ZoomedInPlot: React.FC<ZoomedInPlotProps> = ({
2928 }
3029 } , [ ] )
3130
32- const onPlotChange = ( ) => {
31+ const onNewView = ( ) => {
3332 const actions = zoomedInPlotRef . current ?. querySelector ( '.vega-actions' )
34- const createdRawDataAction = actions ?. querySelector (
35- `.${ styles . vegaCustomAction as string } `
36- )
37- if ( createdRawDataAction ) {
38- return
39- }
4033 const rawDataAction = document . createElement ( 'a' )
4134 rawDataAction . textContent = 'Save Raw Data'
4235 rawDataAction . addEventListener ( 'click' , ( ) => {
@@ -46,8 +39,6 @@ export const ZoomedInPlot: React.FC<ZoomedInPlotProps> = ({
4639 actions ?. append ( rawDataAction )
4740 }
4841
49- useMutationObserver ( zoomedInPlotRef , onPlotChange )
50-
5142 return (
5243 < div
5344 className = { styles . zoomedInPlot }
@@ -66,6 +57,7 @@ export const ZoomedInPlot: React.FC<ZoomedInPlotProps> = ({
6657 export : true ,
6758 source : false
6859 } }
60+ onNewView = { onNewView }
6961 />
7062 </ div >
7163 )
0 commit comments