DiamondLightSource / DiamondLightSource/ImagingHub

Bad set state in WorkflowStatus component

Open
#85 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2
Forks
1
Avg merge
7h 4m
Merged PRs (30d)
24

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.