freeCodeCamp / curriculum

The freeCodeCamp curriculum and lesson editor
Creative Commons Attribution Share Alike 4.0 International
81 stars 124 forks source link

fix(challenges): remove race condition from react lifecycle challenge #270

Closed ojeytonwilliams closed 6 years ago

ojeytonwilliams commented 6 years ago

Description

Previously it was possible for the tests to fail if the timeout in componentDidMount() was too small - less than approximately 500ms. This change sets the state and checks that the component has been correctly rendered synchronously. As a result the timeout can be changed without issue.

Pre-Submission Checklist

Checklist:

Closes freeCodeCamp/freeCodeCamp#17988

scissorsneedfoodtoo commented 6 years ago

@ojeytonwilliams, sorry for the delay in reviewing this. Just checked it out and everything works great, even with a 0ms delay!

Congratulations on your first contribution to freeCodeCamp! Thank you for taking the time to fix this issue. We're all really looking forward to your next contribution :+1: :+1:

ojeytonwilliams commented 6 years ago

@scissorsneedfoodtoo No worries about the delay - reviewing things can't be an easy process! I'm just glad it worked in this case.