The search feature in the tutorial has a race condition


#1

I’m new to ember.js, and the tutorial is extremely helpful and in depth! I’ve noticed the “super-rentals” tutorial app has a race condition, and I think it would be tremendously valuable to implement the fix as another section in the tutorial.

Specifically, the “filter by city” search feature does not properly update if I type and then backspace in quick succession. This seems like a race condition, and being new to ember.js, I have no idea where to even begin fixing it. This kind of issue is one of the reasons ember.js (and client-side programming in general) is so daunting for me, and learning how to approach the problem would remove a big barrier to adoption for people like me.

I have deep background in server-side C#, which is very literal and orthogonal, so the highly flexible, expressive syntax of JS hides what looks like a lot of magic. Fixing a common real-world problem like an async race condition would be a great way to demystify how these things work for new learners.

Is there anyone who could demonstrate a fix?


#2

Hi there, that is a great question.

Take a look at Ember Concurrency, especially this presentation. There is a bit of debate about how heavily to use e-c in the ember community, but the people I respect tend to use it quite a bit.


#3

Hi @element533,

We’ve discussed this and the conclusion is that explaining this in a satisfactory manner is outside the scope of the Guides. Like you mention, this isn’t an exactly easy problem to solve, but it is orthogonal to Ember.js so figuring it out in general means figuring it out for Ember.js. One thing to keep in mind is that while you already have deep technical knowledge, we have found that is not the case with most of the readers, and they might feel lost.

Like @zachaysan mentions, what we’re thinking of doing is linking to ember-concurrency, maybe even directly to a similar auto-complete search. More advanced resources are planned, but low priority for a variety of reasons.