react 18 fix misc

pull/4355/head
yann300 11 months ago
parent d872029740
commit 8f557918df
  1. 6
      apps/remix-ide/src/app/files/fileManager.ts
  2. 5
      libs/remix-solidity/src/compiler/compiler.ts

@ -619,7 +619,11 @@ class FileManager extends Plugin {
if (!provider) throw createError({ code: 'ENOENT', message: `${path} not available` }) if (!provider) throw createError({ code: 'ENOENT', message: `${path} not available` })
// TODO: change provider to Promise // TODO: change provider to Promise
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.currentFile() === path) return resolve(this.editor.currentContent()) if (this.currentFile() === path) {
const editorContent = this.editor.currentContent()
resolve(editorContent || '')
return
}
provider.get(path, (err, content) => { provider.get(path, (err, content) => {
if (err) reject(err) if (err) reject(err)
resolve(content) resolve(content)

@ -50,7 +50,6 @@ export class Compiler {
if (success && this.state.compilationStartTime) { if (success && this.state.compilationStartTime) {
this.event.trigger('compilationDuration', [(new Date().getTime()) - this.state.compilationStartTime]) this.event.trigger('compilationDuration', [(new Date().getTime()) - this.state.compilationStartTime])
} }
this.state.compilationStartTime = null
}) })
this.event.register('compilationStarted', () => { this.event.register('compilationStarted', () => {
@ -83,7 +82,7 @@ export class Compiler {
*/ */
internalCompile(files: Source, missingInputs?: string[], timeStamp?: number): void { internalCompile(files: Source, missingInputs?: string[], timeStamp?: number): void {
if(timeStamp != this.state.compilationStartTime && this.state.compilerRetriggerMode == CompilerRetriggerMode.retrigger ) { if(timeStamp < this.state.compilationStartTime && this.state.compilerRetriggerMode == CompilerRetriggerMode.retrigger ) {
return return
} }
this.gatherImports(files, missingInputs, (error, input) => { this.gatherImports(files, missingInputs, (error, input) => {
@ -294,7 +293,7 @@ export class Compiler {
this.state.worker.addEventListener('message', (msg: Record<'data', MessageFromWorker>) => { this.state.worker.addEventListener('message', (msg: Record<'data', MessageFromWorker>) => {
const data: MessageFromWorker = msg.data const data: MessageFromWorker = msg.data
if (this.state.compilerRetriggerMode == CompilerRetriggerMode.retrigger && data.timestamp !== this.state.compilationStartTime) { if (this.state.compilerRetriggerMode == CompilerRetriggerMode.retrigger && data.timestamp < this.state.compilationStartTime) {
// drop message from previous compilation // drop message from previous compilation
return return
} }

Loading…
Cancel
Save