From edd495d789bebe12127233b1bd428fca577c46ba Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Wed, 11 Jan 2023 15:08:48 +0530 Subject: [PATCH 1/3] fix hide warnings --- libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index 5b717e7712..411ccfa9d6 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -43,7 +43,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { const hide = await api.getAppParameter('hideWarnings') as boolean || false setHideWarnings(hide) })() - }, []) + }) useEffect(() => { if (badgeStatus[currentFile]) { From ff8e42636f942515ceb14cbf80abc4200483e8e5 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Wed, 11 Jan 2023 17:58:39 +0530 Subject: [PATCH 2/3] add dep in useeffect --- libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index 411ccfa9d6..328797acf3 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -43,7 +43,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { const hide = await api.getAppParameter('hideWarnings') as boolean || false setHideWarnings(hide) })() - }) + }, [compileErrors]) useEffect(() => { if (badgeStatus[currentFile]) { From 83454a2768fa1f721bb453fff0d9ba8aad5d7d24 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Thu, 12 Jan 2023 14:10:16 +0530 Subject: [PATCH 3/3] remove warnings from badge too --- apps/solidity-compiler/src/app/compiler-api.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index 596ea04446..745c4ec8f0 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -283,10 +283,12 @@ export const CompilerApiMixin = (Base) => class extends Base { if (success) { // forwarding the event to the appManager infra this.emit('compilationFinished', source.target, source, 'soljson', data, input, version) - if (data.errors && data.errors.length > 0) { + const hideWarnings = await this.getAppParameter('hideWarnings') + if (data.errors && data.errors.length > 0 && !hideWarnings) { + const warningsCount = data.errors.length this.statusChanged({ - key: data.errors.length, - title: `compilation finished successful with warning${data.errors.length > 1 ? 's' : ''}`, + key: warningsCount, + title: `compilation successful with ${warningsCount} warning${warningsCount > 1 ? 's' : ''}`, type: 'warning' }) } else this.statusChanged({ key: 'succeed', title: 'compilation successful', type: 'success' })