Opened 8 years ago

Closed 8 years ago

#13654 closed defect (fixed)

MVC - StatefulModel does not properly serialize an empty array with toPlainObject

Reported by: ben hockey Owned by: rahul
Priority: high Milestone: 1.7
Component: DojoX MVC Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

the following code logs an empty string rather than an empty array

require(['dojox/mvc/StatefulModel'], function (Stateful) {
  var m = new Stateful({ data: {arr: []} });
  console.log(m.arr.toPlainObject()); // <-- expected [] but got ""
});

it looks like there is code that tries to handle this case at http://bugs.dojotoolkit.org/browser/dojo/dojox/trunk/mvc/StatefulModel.js?rev=25762#L231 but it appears that perhaps that logic should be moved down to the block at http://bugs.dojotoolkit.org/browser/dojo/dojox/trunk/mvc/StatefulModel.js?rev=25762#L239. i haven't tried this change but that would appear it might produce something closer to what's expected.

Change History (4)

comment:1 Changed 8 years ago by Ed Chatelain

I made this update along with others via this changeset: In [26567] which was made for ticket #13773

comment:2 Changed 8 years ago by Ed Chatelain

Actually I put the wrong changeset in the last comment, this is the changeset which included the fix. http://bugs.dojotoolkit.org/changeset/26566/dojo A test was also updated to test this. I think this ticket can be closed.

comment:3 Changed 8 years ago by ben hockey

Resolution: fixed
Status: newclosed

comment:4 Changed 8 years ago by bill

Milestone: tbd1.7
Note: See TracTickets for help on using tickets.