@@ -13,10 +13,13 @@ import {staticImageAccepterPropType} from '../../../modules/static-image-accepte
1313import { preloadImage } from '../../../modules/utils' ;
1414
1515import './style.css' ;
16+ import { AnalyticsContext } from '@/static/new-ui/providers/analytics' ;
1617
1718const PRELOAD_IMAGE_COUNT = 3 ;
1819
1920class ScreenshotAccepter extends Component {
21+ static contextType = AnalyticsContext ;
22+
2023 static propTypes = {
2124 view : PropTypes . shape ( {
2225 diffMode : PropTypes . string . isRequired
@@ -58,6 +61,8 @@ class ScreenshotAccepter extends Component {
5861 for ( let i = 1 ; i <= PRELOAD_IMAGE_COUNT ; i ++ ) {
5962 this . _preloadAdjacentImages ( activeImageIndex , stateNameImageIds , i ) ;
6063 }
64+
65+ this . analytics = this . context ;
6166 }
6267
6368 componentDidUpdate ( ) {
@@ -138,7 +143,7 @@ class ScreenshotAccepter extends Component {
138143 if ( this . props . staticImageAccepter . enabled ) {
139144 this . props . actions . staticAccepterUndoDelayScreenshot ( ) ;
140145 } else {
141- await this . props . actions . undoAcceptImage ( imageId , { skipTreeUpdate : true } ) ;
146+ await this . props . actions . thunkRevertImages ( { imageIds : [ imageId ] , shouldCommitUpdatesToTree : false } ) ;
142147 this . delayedTestResults . pop ( ) ;
143148 }
144149
@@ -164,7 +169,7 @@ class ScreenshotAccepter extends Component {
164169
165170 this . props . actions . staticAccepterStageScreenshot ( imageIdsToStage ) ;
166171 } else {
167- this . props . actions . applyDelayedTestResults ( this . delayedTestResults ) ;
172+ this . props . actions . commitAcceptedImagesToTree ( this . delayedTestResults ) ;
168173 }
169174
170175 this . props . onClose ( ) ;
@@ -184,7 +189,8 @@ class ScreenshotAccepter extends Component {
184189 }
185190
186191 async _acceptScreenshot ( imageId , stateName ) {
187- const updatedData = await this . props . actions . screenshotAccepterAccept ( imageId ) ;
192+ const updatedData = await this . props . actions . thunkAcceptImages ( { imageIds : [ imageId ] , shouldCommitUpdatesToTree : false } ) ;
193+ this . analytics ?. trackScreenshotsAccept ( ) ;
188194
189195 if ( updatedData === null ) {
190196 return null ;
0 commit comments