Skip to content

Bad set state in WorkflowStatus component #85

Description

@Oli-Jones475

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions