title: How to switch to another Observable when a source Observable emits but only use latest value
body: <p>I have two observables</p>
  
  <ul>
  <li><code>load$</code> is a stream of load events, emitted on startup or when a reload button is clicked</li>
  <li><code>selection$</code> is a stream of selected list items, emitted when a list item is selected</li>
  </ul>
  
  <p>I'm wondering if there is an operator that lets me (A) get the latest value emitted by <code>selection$</code> whenever <code>load$</code> emits, while (B) ignoring the value emitted by <code>load$</code>.</p>
  
  <p>I was able to accomplish (A) by using <code>withLatestFrom</code> but that doesn't satisfy (B) because <code>withLatestFrom</code> does not ignore the source observable.</p>
  
  <pre><code>load$.withLatestFrom(selection$).subscribe(([_, latestSelection) =&gt; {
    // _ is not needed and I don't like to write code like this
    // I only need the latest selection
  });
  </code></pre>
  
  <p>I've looked at <code>switchMapTo</code> which satisfies (B) but not (A) without also using <code>first()</code> or <code>take(1)</code>.</p>
  
  <pre><code>load$.switchMapTo(selection$.take(1)).subscribe(latestSelection =&gt; {
    // I would like to avoid having to use take(1)
  });
  </code></pre>
  
  <p>I'm looking for a hypothetical <code>switchMapToLatestFrom</code> operator.</p>
  
  <pre><code>load$.switchMapToLatestFrom(selection$).subscribe(latestSelection =&gt; {
    // switchMapToLatestFrom doesn't exist :(
  });
  </code></pre>
  
  <p>Unfortunately it doesn't exist and I don't like the two other ways that I came up with because it's not immediately obvious why the code contains <code>take(1)</code> or unused arguments.</p>
  
  <p>Are there any other ways to combine two observables so that the new observable emits only the latest value from the second observable whenever the first observable emits?</p>