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;
react {
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) {
assert this.ui.html('.todo-list',
Mustache.render(getTemplate(this.editing

View File

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