From e51bfabe981d2a0e6a18e43cd9d0a83c4ec31991 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 29 Jun 2023 14:59:51 +0100 Subject: [PATCH] fix warning/error type issue --- apps/remix-ide/src/app/tabs/analysis-tab.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/analysis-tab.js b/apps/remix-ide/src/app/tabs/analysis-tab.js index e53573e0b0..13d6aea573 100644 --- a/apps/remix-ide/src/app/tabs/analysis-tab.js +++ b/apps/remix-ide/src/app/tabs/analysis-tab.js @@ -50,15 +50,13 @@ class AnalysisTab extends ViewPlugin { this.event.register('staticAnaysisWarning', (count) => { let payloadType = '' - let hasError = this.hints && this.hints.some(hint => hint.type === 'error') - if (hasError) { - payloadType = 'error'; - } else { - let hasWarning = this.hints.some(hint => hint.type === 'warning') - if (hasWarning) { - payloadType = 'warning'; + this.hints && this.hints.length > 0 ? this.hints.forEach(hint => { + if (hint.type === 'error') { + payloadType = 'error' + } else if (hint.type === 'warning' && payloadType !== 'error') { + payloadType = 'warning' } - } + }) : payloadType = 'warning' if (count > 0) { // this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: payloadType })