Opened 11 years ago

Closed 11 years ago

#7145 closed defect (fixed)

dojo.data.ItemFileWriteStore: possible problem when calling store.revert()

Reported by: Nathan Toone Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.2
Component: Data Version: 1.1.1
Keywords: Cc: rgl@…
Blocked By: Blocking:

Description

This is from rgl on IRC:

The attached file contains an example (my first attempt at using it *G*) using DataGrid? and ItemFileWriteStore?; After you run the next steps, it ends with something I wasn't expecting:

  1. Click Append Row
  2. Select the appended row on the grid
  3. Click Delete Selected Rows
  4. Click Revert
  5. For some reason the grid is not empty

Attachments (3)

datagrid.html (4.0 KB) - added by Nathan Toone 11 years ago.
dojox.data_AndOrWriteStore_20080716.patch (1.6 KB) - added by Jared Jurkiewicz 11 years ago.
dojo.data_ItemFileWriteStore_20080716.patch (1.6 KB) - added by Jared Jurkiewicz 11 years ago.

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by Nathan Toone

Attachment: datagrid.html added

comment:1 Changed 11 years ago by Nathan Toone

Cc: rgl@… added

I have confirmed that this also occurs if you have an IFWS and call: store.newItem(); store.deleteItem(); store.revert();

It would be expected (since no save has occured) that the store should be empty - however, deleting a newly-created item and then reverting retains the newly-created item.

comment:2 Changed 11 years ago by bitranch

I just bumped into this yesterday. The problem is that the revert actions in ItemFileWriteStore.revert() are in reverse order.

Changes should be reverted in the order: deleted, modified, new. (Currently they're reverted in the order: new, modified, deleted. So a new item that's later either modified or deleted will be reverted by the "new" block, then re-inserted by the modified/delete revert.)

Swapping the new and delete blocks in revert() should fix the problem.

comment:3 Changed 11 years ago by Jared Jurkiewicz

Reversing the order definitely fixes it. Running tests now on IE, Firefox, and Safari to verify it doesn't break anything. Will submit patches to this tracker, then commit the change.

comment:4 Changed 11 years ago by Jared Jurkiewicz

Tested on:

Safari 3.1

IE 6

Firefox 2.0.0.16

comment:5 Changed 11 years ago by Jared Jurkiewicz

Milestone: tbd1.2

Changed 11 years ago by Jared Jurkiewicz

Changed 11 years ago by Jared Jurkiewicz

comment:6 Changed 11 years ago by Jared Jurkiewicz

(In [14455]) Fixing issue with revert. \!strict refs #7145

comment:7 Changed 11 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [14456]) Fixing issue with revert. \!strict fixes #7145

Note: See TracTickets for help on using tickets.