realm-swift icon indicating copy to clipboard operation
realm-swift copied to clipboard

Set oldValue in object notifications from changes performed on the same thread as the notification

Open rscholtes opened this issue 8 years ago • 5 comments

Goals

Retrieve correct object change notifications

Expected Results

Get the oldValue and newValue properties set to the correct values

Actual Results

oldValue is always nil

Steps to Reproduce

Run the provided example project provided via e-mail

Version of Realm and Tooling

Realm version: 2.4.4

Xcode version: 8.2.1

iOS/OSX version: 10.12.3

Dependency manager + version: CocoaPods 1.2.1.beta.1

rscholtes avatar Mar 17 '17 11:03 rscholtes

Thanks for filing this @rscholtes. I was able to reproduce the issue with the project you sent. As far as I understand this, this would be a bug. But I'd like @tgoyne to confirm in case there's something else at play here.

jpsim avatar Mar 17 '17 15:03 jpsim

Thanks for the quick reply! If you require anything else, let me know

rscholtes avatar Mar 17 '17 15:03 rscholtes

oldValue is not set if the write is made on the same thread as the notification and in your sample project all of the writes are being made on the main thread.

tgoyne avatar Mar 17 '17 17:03 tgoyne

Right. Since I don't think we have a ticket tracking lifting that limitation, I'll convert this ticket to a feature request, although I don't think this is something we'll be doing in the near future.

jpsim avatar Mar 17 '17 17:03 jpsim

Isn't there a single app that needs save/cancel logic in more than 1 screen? We have this functionality where you edit an object and all corresponding related objects and it is a real hell to manually duplicate the object and edit it outside the database and put it back. Why can't there be a normal manager similar to the Core Data Undo Manager?

o15a3d4l11s2 avatar Nov 19 '18 12:11 o15a3d4l11s2