Maintain separation between terminate and handleEvent phases; fixes bug.

This commit is contained in:
Tony Garnock-Jones 2016-05-17 20:50:11 -04:00
parent b559ab04f8
commit 6160012576
2 changed files with 11 additions and 15 deletions

View File

@ -61,10 +61,6 @@ function todoListItemView(id) {
this.editing = false; this.editing = false;
react { react {
during todo(id, $title, $completed) { during todo(id, $title, $completed) {
// BUG: terminate() kills off the during show subfacet
// entirely?!?! Yes, it should kill "its" children - but which
// are its children? We need some way of distinguishing by
// instantiation.
during show(completed) { during show(completed) {
assert this.ui.html('.todo-list', assert this.ui.html('.todo-list',
Mustache.render(getTemplate(this.editing Mustache.render(getTemplate(this.editing

View File

@ -149,18 +149,18 @@ Facet.prototype.onEvent = function(isTerminal, eventType, subscriptionFn, projec
: e.patch.removed, : e.patch.removed,
spec); spec);
if (objects && objects.size > 0) { if (objects && objects.size > 0) {
facet.actor.pushAction(function () { var shouldTerminate = isTerminal;
var shouldTerminate = isTerminal; objects.forEach(function (o) {
objects.forEach(function (o) { var instantiated = Trie.instantiateProjection(spec, o);
var instantiated = Trie.instantiateProjection(spec, o); if (facet.interestWas(eventType, instantiated)) {
if (facet.interestWas(eventType, instantiated)) { if (shouldTerminate) {
if (shouldTerminate) { shouldTerminate = false;
shouldTerminate = false; facet.terminate();
facet.terminate();
}
Util.kwApply(handlerFn, facet.actor.state, o);
} }
}); facet.actor.pushAction(function () {
Util.kwApply(handlerFn, facet.actor.state, o);
});
}
}); });
} }
} }