zooniverse / front-end-monorepo

A rebuild of the front-end for zooniverse.org
https://www.zooniverse.org
Apache License 2.0
104 stars 29 forks source link

app-project: React Hooks error in WorkflowAssignmentModal #6413

Open eatyourgreens opened 1 month ago

eatyourgreens commented 1 month ago

Package

To Reproduce

Run the tests for the project app and check the output for StandardLayout. The tests break the rules of hooks, but still pass, so it's easy to miss this error. I only noticed it because it generated a large block of red text in the terminal, and I happened to be watching when the tests ran.

Expected behavior

React hooks have to run in the same order during every render of a component. Breaking the rules of hooks should probably fail the CI tests.

goplayoutside3 commented 3 days ago

Trying to replicate this by running yarn test isolated to StandardLayout. Has this warning been resolved by recent changes to the workflow assignment feature?

eatyourgreens commented 3 days ago

It's still showing up in the project app tests, but I don't know how to isolate it.

https://github.com/zooniverse/front-end-monorepo/actions/runs/12019334877/job/33505680307#step:9:676 (around about line 669 in the logs.)

Log output from the project app tests, showing a change in the order of hooks during a render.
goplayoutside3 commented 3 days ago

Weird. It looks like the warning is generated by ClassifyPageContainer, and even specifies the test is wrapped by enzyme, which is true of ClassifyPageContainer.spec.js, but isolating those tests and running yarn test:ci does not replicate the warning locally.