Commit 493511fe authored by tizah's avatar tizah

fix failing test

parent e6ae1d35
......@@ -81,20 +81,25 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const [warningState, setWarningState] = useState([])
useEffect(() => {
if (autoRun) {
const setCompilationResult = async (data, source, file) => {
await setResult({ lastCompilationResult: data, lastCompilationSource: source, currentFile: file })
}
if (props.analysisModule) {
props.analysisModule.on(
'solidity',
'compilationFinished',
(file, source, languageVersion, data) => {
if (languageVersion.indexOf('soljson') !== 0) return
setCompilationResult(data, source, file)
if(categoryIndex.length > 0){
run(data, source, file)
}
}
)
}
} else {
......@@ -102,7 +107,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
return () => { }
}, [autoRun])
}, [autoRun, categoryIndex])
const run = (lastCompilationResult, lastCompilationSource, currentFile) => {
// const highlightLocation = async (location, fileName) => {
......@@ -197,8 +202,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const groupedCategory = groupBy(resultArray, 'warningModuleName')
setWarningState(groupedCategory)
})
if(categoryIndex.length > 0){
props.event.trigger('staticAnaysisWarning', [warningCount])
}
} else {
setRunButtonState(true)
if (categoryIndex.length) {
......@@ -217,8 +223,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
})
)
} else {
setCategoryIndex(_.uniq([...categoryIndex, ...index]))
setCategoryIndex(_.uniq([...categoryIndex]))
}
}
const handleCheckOrUncheckCategory = (category) => {
......@@ -353,9 +360,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
{result.currentFile && result.currentFile}
</span>
</div>
{ Object.entries(warningState).length > 0 &&
{ categoryIndex.length > 0 && Object.entries(warningState).length > 0 &&
<div id='staticanalysisresult' >
<div className="mb-4 warning">
<div className="mb-4">
{
(Object.entries(warningState).map((element) => (
<>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment