Lazy Fetching - Bug?

  • I've got a sample project at

    https://github.com/ericgorr/LazyFetching

    which demonstrates some strange behavior I am seeing.

    If you build and run the project, what I did was to:

    (1) Press the top + button and name the entry 'a'
    (2) Press the top + button again and name the entry 'b'
    (3) Pressed the top column header to sort the items in ascending order.
    (4) Make sure the 'b' entry is selected
    (5) Pressed the bottom + button and rename the entry to anything

    What I see happen then is the rows in the upper (Shelf) table change order so that the 'b' entry is listed first.

    If I press the Info button, what it will do is:

    (1) NSLog the sort descriptors for the Shelf Array Controller
    (2) Print the names of the entries in the arrangedObjects array of the Shelf Array Controller
    (3) Call rearrangeObjects on Shelf Array Controller
    (4) Print out the names of the entries in the arrangedObjects array of the Shelf Array Controller

    After all of this, I see, as expected, a single sort descriptor on the Shelf Array Controller:  name, ascending, compare:

    And the following output for arrangedObjects:

    2013-05-19 16:08:56.023 LazyFetching[11791:303] b
    2013-05-19 16:08:56.024 LazyFetching[11791:303] a

    and

    2013-05-19 16:08:56.024 LazyFetching[11791:303] b
    2013-05-19 16:08:56.024 LazyFetching[11791:303] a

    For some reason, it is no longer sorting the items in the Shelf Array Controller.

    If I turn off Lazy Fetching for the Shelf Array Controller, everything seems to work correctly.

    So, what I don't understand is why I am seeing this behavior with Lazy Fetching enabled. It seems possible that it is a bug. If so, I can certainly file what is likely to be a duplicate report. But, I am guessing, there is some good explanation and a standard way of dealing with it so items remain sorted by the sort descriptors in the arrangedObjects array of the array controller.
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today