@@ -23,6 +23,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
2323 const [ state , setState ] = useState ( {
2424 hideWarnings : false ,
2525 autoCompile : false ,
26+ matomoAutocompileOnce : true ,
2627 optimize : false ,
2728 compileTimeout : null ,
2829 timeout : 300 ,
@@ -69,7 +70,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
6970 const optimize = params . optimize
7071 const runs = params . runs as string
7172 const evmVersion = params . evmVersion
72-
7373 return {
7474 ...prevState ,
7575 hideWarnings : api . getAppParameter ( 'hideWarnings' ) as boolean || false ,
@@ -135,6 +135,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
135135 }
136136 } , [ configurationSettings ] )
137137
138+ const _retrieveVersion = ( version ?) => {
139+ if ( ! version ) version = state . selectedVersion
140+ if ( version === 'builtin' ) version = state . defaultVersion
141+ return semver . coerce ( version ) ? semver . coerce ( version ) . version : ''
142+ }
143+
138144 // fetching both normal and wasm builds and creating a [version, baseUrl] map
139145 const fetchAllVersion = async ( callback ) => {
140146 let selectedVersion , allVersionsWasm , isURL
@@ -281,7 +287,14 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
281287 compileIcon . current . setAttribute ( 'title' , 'idle' )
282288 compileIcon . current . classList . remove ( 'remixui_spinningIcon' )
283289 compileIcon . current . classList . remove ( 'remixui_bouncingIcon' )
284- _paq . push ( [ 'trackEvent' , 'compiler' , 'compiled_with_version' , _retrieveVersion ( ) ] )
290+ if ( ! state . autoCompile || ( state . autoCompile && state . matomoAutocompileOnce ) ) {
291+ _paq . push ( [ 'trackEvent' , 'compiler' , 'compiled_with_version' , _retrieveVersion ( ) ] )
292+ if ( state . autoCompile && state . matomoAutocompileOnce ) {
293+ setState ( prevState => {
294+ return { ...prevState , matomoAutocompileOnce : false }
295+ } )
296+ }
297+ }
285298 }
286299
287300 const scheduleCompilation = ( ) => {
@@ -305,12 +318,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
305318 compileTabLogic . runCompiler ( hhCompilation )
306319 }
307320
308- const _retrieveVersion = ( version ?) => {
309- if ( ! version ) version = state . selectedVersion
310- if ( version === 'builtin' ) version = state . defaultVersion
311- return semver . coerce ( version ) ? semver . coerce ( version ) . version : ''
312- }
313-
314321 const _updateVersionSelector = ( version , customUrl = '' ) => {
315322 // update selectedversion of previous one got filtered out
316323 let selectedVersion = version
@@ -384,7 +391,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
384391
385392 const handleLoadVersion = ( value ) => {
386393 setState ( prevState => {
387- return { ...prevState , selectedVersion : value }
394+ return { ...prevState , selectedVersion : value , matomoAutocompileOnce : true }
388395 } )
389396 updateCurrentVersion ( value )
390397 _updateVersionSelector ( value )
@@ -405,7 +412,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
405412 api . setAppParameter ( 'autoCompile' , checked )
406413 checked && compile ( )
407414 setState ( prevState => {
408- return { ...prevState , autoCompile : checked }
415+ return { ...prevState , autoCompile : checked , matomoAutocompileOnce : state . matomoAutocompileOnce || checked }
409416 } )
410417 }
411418
0 commit comments