nested switch statements cause a nodeList error #2188

Closed
justinbmeyer opened this Issue Jan 14, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@justinbmeyer
Contributor

justinbmeyer commented Jan 14, 2016

var template  = can.stache("<div>{{#switch page}}"+
    '{{#case "restaurants"}}'+
        "{{#switch action}}"+
            "{{#case 'order'}}"+
                "NEW ORDER PAGE"+
            "{{/case}}"+
        "{{/switch}}"+
    "{{/case}}"+
    '{{#case "order-history"}}'+
        "ORDER HISTORY"+
    "{{/case}}"+
"{{/switch}}</div>");

var vm = new can.Map({
    page: "restaurants",
    action: "order"
});

var frag = template(vm);

can.batch.start();
vm.removeAttr("action");
vm.attr("page","order-history");
can.batch.stop();

throws an error like:

Cannot read property 'push' of null
    at Object.nodeLists.register (http://localhost:8080/canjs/view/node_lists/node_lists.js:328:26)

@justinbmeyer justinbmeyer changed the title from nested case statements cause a nodeList error to nested switch statements cause a nodeList error Jan 14, 2016

justinbmeyer added a commit that referenced this issue Jan 14, 2016

fixes #2188 by making sure computes that are regsitered to be update…
…d don't get updated if they are unbound

@justinbmeyer justinbmeyer added the bug label Jan 14, 2016

@justinbmeyer justinbmeyer added this to the 2.3.10 milestone Jan 14, 2016

@justinbmeyer justinbmeyer self-assigned this Jan 14, 2016

@daffl daffl closed this in #2189 Jan 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment