⚠️ This lesson is retired and might contain outdated information.

Pipe Purity [obsolete]

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 9 years ago
Updated 6 years ago

This lesson is obsolete.

This lesson explains how Pipes only change by default when your Pipe input parameters change and not when your data changes. It also shows you how to make an “unpure” pipe if you always want your pipe to update.

You may have noticed that although changing the option works for great for E, C, and S, that if you try to add a To-do, like Sing or Swing that also start with S, that nothing happens.

This is due to pipe purity, meaning that these pipes, like the one we created that starts with pipe, will only change its output when the input of the pipe changes, not if the data coming into it changes. When selected letter changes, it changes, but not when the data changes.

In this case, because I changed the selected letter from C back to S, you finally see Sing and Swing. Now, if that's not the behavior that you want, you simply come over here and say pure is false to basically tell the pipe to update every time something else updates.

We can say Earn, Estimate, and Elongate. You can see that all of these are updating now, simply because I'm adding more To-dos. Purely from a code perspective, once you set pure to false, you're telling it update every time this changes and every time these change.

If you have pure set to True, or the Default, you say don't update when this changes. Only update when these change.

egghead
egghead
~ 12 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