Ticket #7145 (closed defect: fixed)

Opened 12 months ago

Last modified 12 months ago

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

Reported by: toonetown Owned by: jaredj
Priority: normal Milestone: 1.2
Component: Data Version: 1.1.1
Severity: normal Keywords:
Cc: rgl@…

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

datagrid.html (4.0 kB) - added by toonetown 12 months ago.
dojox.data_AndOrWriteStore_20080716.patch (1.6 kB) - added by jaredj 12 months ago.
dojo.data_ItemFileWriteStore_20080716.patch (1.6 kB) - added by jaredj 12 months ago.

Change History

Changed 12 months ago by toonetown

Changed 12 months ago by toonetown

  • 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.

Changed 12 months 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.

Changed 12 months ago by jaredj

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.

Changed 12 months ago by jaredj

Tested on:

Safari 3.1

IE 6

Firefox 2.0.0.16

Changed 12 months ago by jaredj

  • milestone changed from tbd to 1.2

Changed 12 months ago by jaredj

Changed 12 months ago by jaredj

Changed 12 months ago by jaredj

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

Changed 12 months ago by jaredj

  • status changed from new to closed
  • resolution set to fixed

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

Note: See TracTickets for help on using tickets.