diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 3993d23005..e73f7463e7 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -64,6 +64,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { const warningContainer = React.useRef(null) const [warningState, setWarningState] = useState({}) + const [allWarnings, setAllWarnings] = useState({}) const [state, dispatch] = useReducer(analysisReducer, initialState) useEffect(() => { @@ -72,6 +73,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { useEffect(() => { setWarningState({}) + setAllWarnings({}) if (autoRun) { if (state.data !== null) { run(state.data, state.source, state.file) @@ -126,14 +128,17 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { } const groupedCategory = groupBy(resultArray, groupByKey) + setAllWarnings(groupedCategory) setWarningState(groupedCategory) } const showWarningsByModule = (showOnlyModule: string) => { - if(showOnlyModule && warningState[showOnlyModule]) { + if(allWarnings[showOnlyModule]) { const newWarningState = {} - newWarningState[showOnlyModule] = warningState[showOnlyModule] - setWarningState({[showOnlyModule]: warningState[showOnlyModule]}) + newWarningState[showOnlyModule] = allWarnings[showOnlyModule] + setWarningState({[showOnlyModule]: allWarnings[showOnlyModule]}) + } else if (showOnlyModule === 'all') { + setWarningState(allWarnings) } } @@ -312,6 +317,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { const handleShowSlitherResultEnabled = () => { if (slitherResultEnabled) { setSlitherResultEnabled(false) + showWarningsByModule('all') } else { setSlitherResultEnabled(true) showWarningsByModule('Slither Analysis')