fix autocompile

pull/4355/head
yann300 11 months ago
parent 21d9904ff0
commit 4eadb7ff0e
  1. 5
      libs/remix-ui/solidity-compiler/src/lib/actions/compiler.ts
  2. 15
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -1,5 +1,6 @@
import React from 'react'
import { CompileTabLogic } from '../logic/compileTabLogic'
export const setEditorMode = (mode: string) => {
return {
type: 'SET_EDITOR_MODE',
@ -28,7 +29,7 @@ export const resetCompilerMode = () => (dispatch: React.Dispatch<any>) => {
export const listenToEvents = (compileTabLogic: CompileTabLogic, api) => (dispatch: React.Dispatch<any>) => {
api.onSessionSwitched = () => {
dispatch(setEditorMode('sessionSwitched'))
dispatch(setEditorMode('sessionSwitched_' + Date.now()))
}
compileTabLogic.event.on('startingCompilation', () => {
@ -40,7 +41,7 @@ export const listenToEvents = (compileTabLogic: CompileTabLogic, api) => (dispat
})
api.onContentChanged = () => {
dispatch(setEditorMode('contentChanged'))
dispatch(setEditorMode('contentChanged_' + Date.now()))
}
compileTabLogic.compiler.event.register('loadingCompiler', () => {
dispatch(setCompilerMode('loadingCompiler'))

@ -6,7 +6,7 @@ import {ConfigurationSettings} from '@remix-project/remix-lib'
import {checkSpecialChars, CustomTooltip, extractNameFromKey} from '@remix-ui/helper'
import {canUseWorker, urlFromVersion, pathToURL} from '@remix-project/remix-solidity'
import {compilerReducer, compilerInitialState} from './reducers/compiler'
import {resetEditorMode, listenToEvents} from './actions/compiler'
import {listenToEvents} from './actions/compiler'
import {getValidLanguage} from '@remix-project/remix-solidity'
import {CopyToClipboard} from '@remix-ui/clipboard'
import {configFileContent} from './compilerConfiguration'
@ -231,16 +231,13 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
useEffect(() => {
if (compilerContainer.editor.mode) {
switch (compilerContainer.editor.mode) {
case 'sessionSwitched':
if (compilerContainer.editor.mode.startsWith('sessionSwitched')) {
sessionSwitched()
resetEditorMode()(dispatch)
break
case 'contentChanged':
return
} else if (compilerContainer.editor.mode.startsWith('contentChanged')) {
contentChanged()
resetEditorMode()(dispatch)
break
}
return
}
}
}, [compilerContainer.editor.mode])

Loading…
Cancel
Save