canjs / can-stache

Live binding handlebars templates
https://canjs.com/doc/can-stache.html
MIT License
10 stars 13 forks source link

let is observing itself #676

Closed justinbmeyer closed 5 years ago

justinbmeyer commented 5 years ago

In this codepen: https://codepen.io/rob4acre/pen/bJNVMO, if you click start twice, an infinite loop is created.

It appears that this is due to stache observing itself:

image

justinbmeyer commented 5 years ago

The problem here is that {{ let state = deleting}} is setting let context to a compute like:

letContext.set("state", compute(deleting))

This causes a change, and because it's returning the a different createTextNode() every time, everything gets re-evaluated.