Closed AnsonH closed 1 year ago
A workaround is implemented by allowing useSelectedStageConfig()
hook to return undefined
, and checking whether config
is falsy in the stage settings panel. This should theoretically solve the randomly-occurring TypeError bug.
While the "can't perform state update" warning still persists, we may ignore the warning. This is because it's very difficult to locate the exact reason why this error occurs.
Description
The following error occur when:
Full stacktrace
``` 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 FileStructureValidationSettings (webpack-internal:///./components/GuiBuilder/StageSettings/FileStructureValidationSettings.tsx:121:110) at LoadableImpl (webpack-internal:///./node_modules/next/dist/shared/lib/loadable.js:103:38) window.console.error @ next-dev.js?3515:32 overrideMethod @ react_devtools_backend.js:4012 printWarning @ react-dom.development.js?ac89:67 error @ react-dom.development.js?ac89:43 warnAboutUpdateOnUnmountedFiberInDEV @ react-dom.development.js?ac89:23914 scheduleUpdateOnFiber @ react-dom.development.js?ac89:21840 dispatchAction @ react-dom.development.js?ac89:16139 handleStoreChange @ use-sync-external-store-shim.development.js?3e9a:188 dispatch @ redux.js?ebf2:297 e @ VM87126:1 eval @ index.js?62bd:688 eval @ index.js?62bd:1018 eval @ index.js?62bd:906 eval @ index.js?511b:20 eval @ index.js?62bd:1005 dispatch @ VM87126:1 actionCreator @ index.js?62bd:782 updateNodesAndEdgesSelections @ index.js?139d:1888 addSelectedNodes @ index.js?139d:3189 handleNodeClick @ index.js?139d:1361 eval @ index.js?139d:1410 call @ dispatch.js?bb82:57 gesture @ drag.js?ac8f:148 mousedowned @ drag.js?ac8f:62 eval @ on.js?c2d6:3 ```https://user-images.githubusercontent.com/57580593/210126456-3477906a-6da5-436c-9953-dbae215da2f9.mp4
Fatal Error
Occasionally the entire app may crash because
useSelectedStageConfig()
returns anundefined
config.Investigation
See easy-peasy issue #306
useSelectedStageConfig()
FileStructureValidation
is empty andDiffWithSkeleton
uses that hook.action.onStageNodeChange
useSelectedStageConfig()
The error persists if:
useSelectedStageConfig()
into the stage settings panel (so directly use the store'sselectedStage
stateDebugging
react-dom.development.js:23914
Inspect call stack of the error -->
actionCreator
--> Seepayload
is from theonStageNodesChange()
Workaround
This stack overflow answer suggests that the warning may be a false positive.
A suggestion is to make
useSelectedStageConfig()
's return value nullable.