Remember to Check for Done

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

It's easy to forget to account for "done" when you're not working with sequences or any sort of completion. But it's important to remember that all timers have an end which will push out a "done" value so any operator using a timer will need to handle the "done" case.

Instructor: [0:00] Moving on to the next demo, I'm just going to check out to before the React refactor and I realized making this demo, once I type in STAR, you'll see in the Network tab, we're back to making two requests, which means that I made the classic blunder of using, when I created my waitFor, using a create timeout without handling the done.

[0:26] I'm going to call this value timeoutValue. If timeoutValue is done, just guard against it. When I search again, type in STAR, we're back to a single request. Again, this is the scenario to watch out for once you're using things that can't be done inside of other operators. We never want waitFor to be done because of this. We make it a done from outside of it, but it has no concept of an internal done.

egghead
egghead
~ 11 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today