Mentioned in the documentation
SOLVED: call useEffect to set state so it is changed after render
https://github.com/DiamondLightSource/TomoHub/blob/e8095d9d6aec18d6258a32a3d7205ee438b38066/frontend/src/components/workflows/WorkflowStatus.tsx#L226-L234
If the useEffect is removed the following error occurs:
Warning: Cannot update a component (CropProvider) while rendering a different component (WorkflowStatus). To locate the bad setState() call inside WorkflowStatus, follow the stack trace as described in https://reactjs.org/link/setstate-in-render WorkflowStatus@http://localhost:5173/src/components/workflows/WorkflowStatus.tsx?t=1764062699314:83:24 div div...
Although this is no longer an issue the fix and the core problem are not fully understood.
Mentioned in the documentation
SOLVED: call useEffect to set state so it is changed after render
https://github.com/DiamondLightSource/TomoHub/blob/e8095d9d6aec18d6258a32a3d7205ee438b38066/frontend/src/components/workflows/WorkflowStatus.tsx#L226-L234
If the useEffect is removed the following error occurs:
Warning: Cannot update a component (
CropProvider) while rendering a different component (WorkflowStatus). To locate the bad setState() call insideWorkflowStatus, follow the stack trace as described in https://reactjs.org/link/setstate-in-render WorkflowStatus@http://localhost:5173/src/components/workflows/WorkflowStatus.tsx?t=1764062699314:83:24 div div...Although this is no longer an issue the fix and the core problem are not fully understood.