Recursive setTimeouts prevent rendering

I posted the following question and got the solution on gitter and am posting it here for reference.

I am recursively calling setTimeout and when I do, stache never renders. I think the reason is because can-wait overrides setTimeout with it’s own version. And then waits for it to resolve before rendering, but since it is recursive, it never finishes. How to get around this?

   loadSlide(slides, index) {
    var self = this, cs = slides[index], 
    next = (index + 1) % slides.length;
    this.attr('currentSlide', cs);
    setTimeout(function() {, slides, next);
      cs.props.duration * 1000

@matthewp said:

Yeah, if you are recursively calling setTimeout you will want to ignore that
you can do var ignore = require(‘can-wait/ignore’)
which allows you to wrap some code you want to run outside of the zone

 var fn = ignore(function() { setTimeout(function{ .... } } )
fn(); // You'll get the real setTimeout

Link to gitter conversation: