Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    82
    Vote Rating
    1
    dr-dan is on a distinguished road

      0  

    Default store.add() does nothing

    store.add() does nothing


    given
    Code:
    mystore
    (a store)

    Code:
    console.log(mystore.getCount()) // == 4
    store.add(model);
    console.log(mystore.getCount()) // == 4
    No error reported.

    == a revert back to 4.1 (which works)

  2. #2
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    42
    Vote Rating
    4
    Dev@QLP is on a distinguished road

      0  

    Default


    Quote Originally Posted by dr-dan View Post
    given
    Code:
    mystore
    (a store)
    Might need a little more code then that to help you troubleshoot. It seems to work fine for me using the latest nightly: v4.2.0.449

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    82
    Vote Rating
    1
    dr-dan is on a distinguished road

      0  

    Default


    I have boiled it down to the fact that I am adding two objects with the same "unassigned" Id of "0"

    Its zero as it will get assigned an id by the server on update. If I update it to be "null" then it works ok. Like I said this was unnecessary with 4.1 so it's a breaking change.

    Code:
    var rs = Ext.create("Pegfect.model.profile.ResponseSet");
                var m1 = Ext.create("Pegfect.model.profile.Response", { Id: null});
                var m2 = Ext.create("Pegfect.model.profile.Response", { Id: null });
    
    
                var hc = [m1, m2];
                rs.responses().removeAll();
                rs.responses().add(hc);
                console.log("hc arr:" + hc.length); //==2
                console.log("hc rs:" + rs.responses().getCount()); //==2
    Code:
    var rs = Ext.create("Pegfect.model.profile.ResponseSet");
                var m1 = Ext.create("Pegfect.model.profile.Response", { Id: 0});
                var m2 = Ext.create("Pegfect.model.profile.Response", { Id: 0});
    
    
                var hc = [m1, m2];
                rs.responses().removeAll();
                rs.responses().add(hc);
                console.log("hc arr:" + hc.length); //==2
                console.log("hc rs:" + rs.responses().getCount()); //==1

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,055
    Vote Rating
    659
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    This is something we won't be fixing. As you suggested, there's a difference between 0 & null. Users have pointed out that 0, although typically not used as an identifier, still represents an explicitly assigned value for an id, so it should be treated as a non-phantom value. Null/undefined values still are treated as phantoms and as such are assigned their own default identifiers.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    82
    Vote Rating
    1
    dr-dan is on a distinguished road

      0  

    Default


    imo the rules as to what makes a record new or existing should not be hard-coded into the framework.

    isNew() config function perhaps?

    Would you consider putting that in your release notes so that others don't have to find out the hard way?

Thread Participants: 2