Let's fix a small UI glitch that was occurring on startup and whenever the refresh button was clicked. In this lesson we will see how to avoid common bad habits of imperative programming, and how to use reactive programming to keep the complete dynamic behavior of a value specified in one convenient place.
Hi. Great videos, many thanks. Why can't you use start with in the previous lesson to load the initial list of users before the refresh button is pressed rather than merging the 2 streams?
Hi Roaders, we wanted to introduce only one new concept per lesson.
Great, thanks for the reply.
Would you be getting a race condition between getting the response from the requestStream and the null event from the refresh stream?
Hi Michel, no we wouldn't, because from refresh to the null
emission, all of this was synchronous, but a response is asynchronous. In worse cases where both are asynchronous, we can still neatly handle race conditions in RxJS using either concat or concatMap or zip, depending on the situation.
This part of transcript is false, else condition must be : 'suggestionEl.style.visibility = 'visible'; if (suggestedUser === null) { suggestedEl.style.visibility = 'hidden'; } else { suggestionEl.style.visibility = 'hidden'; }
That is not an advantage for me. I still wanna show the data, until the data has been completely downloaded from httpRequest and then shows it (directly switched over to the new avatar and text) so it won't be any cleared or spinning loading animations. How could I do that ?