title: Rxjs `distinctUntilChanged()` appears to not be working
body: <p>In an rxjs stream, I'm using <code>distinctUntilChanged</code> with lodash's <code>isEqual</code> to filter out duplicate values. However it <em>appears</em> to not be working as expected. Take the following code snippet</p>
  
  <pre class="lang-js prettyprint-override"><code>import { isEqual } from 'lodash-es';
  
  let cachedValue: any;
  
  function testFn(observableVal: Observable&lt;any&gt;) {
    return observableVal
      .pipe(
        distinctUntilChanged(isEqual),
        tap(val =&gt; {
          const equal = isEqual(cachedValue, val);
          console.log('"output":', equal, cachedValue, val);
          cachedValue = val;
        })
      )
  }
  </code></pre>
  
  <p>In this example, I would expect that <code>const equal</code> inside the <code>tap</code> function would never <code>=== true</code>. I would expect that <code>distinctUntilChanged(isEqual)</code> would filter out any values where <code>isEqual(cachedValue, val) === true</code> --> meaning that <code>const equal === false</code> always. However, console output shows:</p>
  
  <pre><code>"output": false undefined [ContactList]
  "output": true [ContactList] [ContactList]
  "output": true [ContactList] [ContactList]
  "output": true [ContactList] [ContactList]
  </code></pre>
  
  <p>Do I misunderstand something fundamental about how the <code>distinctUntilChanged()</code> operator works? I've posted a simplified example because the actual rxjs stream is very complex, but I wouldn't expect the complexity to make any difference in so far as <code>const equal</code> should always <code>=== false</code> in the <code>tap</code> operator.</p>
  
  <p>I'm just trying to understand what's going on, so any info is appreciated. Thanks!</p>
  
  <h3>Update</h3>
  
  <p>It should be noted that if I change the code to:</p>
  
  <pre class="lang-js prettyprint-override"><code>function testFn(observableVal: Observable&lt;any&gt;) {
    return observableVal
      .pipe(
        filter(val =&gt; {
          const equal = isEqual(cachedValue, val);
          cachedValue = val;
          return !equal;
        }),
        tap(val =&gt; {
          console.log('"output":', val);
        })
      )
  }
  </code></pre>
  
  <p>Then the filtering works as expected. <a href="https://rxjs-dev.firebaseapp.com/api/operators/distinctUntilChanged" rel="noreferrer">I was under the impression that <code>distinctUntilChanged(isEqual)</code> was equivalent to:</a></p>
  
  <pre><code>filter(val =&gt; {
    const equal = isEqual(cachedValue, val);
    cachedValue = val;
    return !equal;
  })
  </code></pre>
  
  <p>Am I mistaken / misunderstanding the <a href="https://rxjs-dev.firebaseapp.com/api/operators/distinctUntilChanged" rel="noreferrer"><code>distinctUntilChanged</code></a> operator?</p>