Opened 7 years ago

Closed 7 years ago

#15928 closed defect (invalid)

[regression] dojo/store/Observable.observe broken in 1.8.0

Reported by: lauri.kimmel Owned by: Kris Zyp
Priority: undecided Milestone: 1.8.1
Component: Data Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description

new Observable(...).query().observe() is not working any more as it was in 1.7.x releases.

Complete example

require(["dojo/store/Memory", "dojo/store/Observable"],
    function(Memory, Observable){
 
        var employees = [
            {name:"Jim", department:"accounting"},
            {name:"Bill", department:"engineering"},
            {name:"Mike", department:"sales"},
            {name:"John", department:"sales"}
        ];
        var employeeStore = new Memory({data:employees, idProperty: "name"});
        var obs = new Observable(employeeStore);
        obs.query().observe(function(obj, from, to) {
            alert("New employee: " + obj.name);
        }, true);
       
        employeeStore.put({ name: "Broken in 1.8.0", department: "test"});
});

http://jsfiddle.net/xfJL6/2/

Change History (3)

comment:1 Changed 7 years ago by lauri.kimmel

Ignore previous jsfiddle link - it's broken.

Correct version http://jsfiddle.net/xfJL6/5/

comment:2 Changed 7 years ago by bill

Component: Storage/FlashData
Milestone: tbd1.8.1
Owner: changed from Shane O'Sullivan to Kris Zyp
Summary: dojo/store/Observable.observe broken in 1.8.0[regression] dojo/store/Observable.observe broken in 1.8.0

comment:3 Changed 7 years ago by Colin Snover

Resolution: invalid
Status: newclosed

Thanks for the report, but this is not a Dojo bug.

In Dojo 1.7, Observable did not correctly create and return a new object but actually altered the original store. In Dojo 1.8, it properly creates a new object. You are putting to the non-Observable store. If you change the last line from employeeStore.put to obs.put it will work correctly.

Note: See TracTickets for help on using tickets.