bitburner-official / bitburner-src

Bitburner source code.
Other
794 stars 258 forks source link

INFILTRATION: Fix React warnings #1423

Closed catloversg closed 3 months ago

catloversg commented 3 months ago

How to trigger warnings:

Warning 1:

Warning: Cannot update a component (`Game`) while rendering a different component (`GameTimer`). To locate the bad setState() call inside `GameTimer`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render
    at GameTimer (webpack://bitburner/./src/Infiltration/ui/GameTimer.tsx?:16:5)
    at BackwardGame (webpack://bitburner/./src/Infiltration/ui/BackwardGame.tsx?:53:80)
    at div
    at eval (webpack://bitburner/./node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js?:56:66)
    at Container (webpack://bitburner/./node_modules/@mui/system/esm/Container/createContainer.js?:115:19)
    at Game (webpack://bitburner/./src/Infiltration/ui/Game.tsx?:50:76)
    at div
    at InfiltrationRoot (webpack://bitburner/./src/Infiltration/ui/InfiltrationRoot.tsx?:19:76)
    at div
    at eval (webpack://bitburner/./node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js?:56:66)
    at Box (webpack://bitburner/./node_modules/@mui/system/esm/createBox.js?:35:72)
    at SnackbarProvider (webpack://bitburner/./node_modules/notistack/dist/notistack.esm.js?:736:24)
    at SnackbarProvider (webpack://bitburner/./src/ui/React/Snackbar.tsx?:32:7)
    at HistoryProvider (webpack://bitburner/./src/ui/React/Documentation.tsx?:48:80)
    at BypassWrapper (webpack://bitburner/./src/ui/React/BypassWrapper.tsx?:7:14)
    at ErrorBoundary (webpack://bitburner/./src/ui/ErrorBoundary.tsx?:14:5)
    at MathJaxContext (webpack://bitburner/./node_modules/better-react-mathjax/esm/MathJaxContext/MathJaxContext.js?:6:592)
    at GameRoot (webpack://bitburner/./src/ui/GameRoot.tsx?:202:7)
    at LoadingScreen (webpack://bitburner/./src/ui/LoadingScreen.tsx?:27:74)
    at ThemeProvider (webpack://bitburner/./node_modules/@mui/private-theming/ThemeProvider/ThemeProvider.js?:43:5)
    at ThemeProvider (webpack://bitburner/./node_modules/@mui/system/esm/ThemeProvider/ThemeProvider.js?:55:5)
    at ThemeProvider (webpack://bitburner/./node_modules/@mui/material/styles/ThemeProvider.js?:24:14)
    at StyledEngineProvider (webpack://bitburner/./node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js?:29:5)
    at TTheme (webpack://bitburner/./src/Themes/ui/Theme.tsx?:365:5)

Warning 2:

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    at Countdown (webpack://bitburner/./src/Infiltration/ui/Countdown.tsx?:10:68)
    at div
    at eval (webpack://bitburner/./node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js?:56:66)
    at Container (webpack://bitburner/./node_modules/@mui/system/esm/Container/createContainer.js?:115:19)
    at Game (webpack://bitburner/./src/Infiltration/ui/Game.tsx?:50:76)
    at div
    at InfiltrationRoot (webpack://bitburner/./src/Infiltration/ui/InfiltrationRoot.tsx?:19:76)