fix loading compilers

pull/4360/head
filip mertens 11 months ago
parent eae83996f3
commit e12d21fd04
  1. 1
      libs/remix-lib/src/types/ICompilerApi.ts
  2. 7
      libs/remix-ui/solidity-compiler/src/lib/api/compiler-api.ts
  3. 9
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx

@ -48,6 +48,7 @@ export interface ICompilerApi {
emit?: (key: string, ...payload: any) => void
setSolJsonBinData: (binData: iSolJsonBinData) => void
solJsonBinData: iSolJsonBinData
}
export interface iSolJsonBinDataBuild {

@ -16,6 +16,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
compileErrors: any
compileTabLogic: CompileTabLogic
configurationSettings: ConfigurationSettings
solJsonBinData: iSolJsonBinData
onCurrentFileChanged: (fileName: string) => void
// onResetResults: () => void
@ -281,7 +282,11 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.on('fileManager', 'fileClosed', this.data.eventHandlers.onFileClosed)
this.on('compilerloader', 'jsonBinDataLoaded', (urls: iSolJsonBinData) => {
this.setSolJsonBinData(urls)
try{
this.setSolJsonBinData(urls)
}catch(e){
}
this.solJsonBinData = urls
})
this.call('compilerloader', 'getJsonBinData')

@ -140,7 +140,10 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
}
api.setSolJsonBinData = (data: iSolJsonBinData) => {
setSolJsonBinData(data)
}
const setSolJsonBinData = (data: iSolJsonBinData) => {
const builtin: iSolJsonBinDataBuild =
{
path: 'builtin',
@ -245,6 +248,12 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
</div>
)
useEffect(() => {
if(!state.solJsonBinData && api.solJsonBinData){
setSolJsonBinData(api.solJsonBinData)
}
},[])
return (
<>
<div id="compileTabView">

Loading…
Cancel
Save