What happens if object is updated but not sync’d?

Stuart Beesley (Mr Toolbox)'s Avatar

Stuart Beesley (Mr Toolbox)

17 Jul, 2021 03:06 PM

Two questions:

1/ what happens if you update an object, perhaps setting .setEditingMode() first, but you never end up calling .syncItem()? Does the original obj remain untouched, or does the object disappear into a black hole?

2 what happens if you update an object, then call .syncItem() and then update the object again, using the original reference to obj, and then call .syncItem() again? Is this OK, or should you retrieve a new reference to the updated object first? Ie does the reference to obj change after any/all .syncItem()s?

Many thanks.

  1. 1 Posted by Stuart Beesley ... on 25 Jul, 2021 12:29 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    From Sean…:

    1. those objects would just sit around in editing mode until the next time that they are synced or updated. If you restart MD while they are in editing mode then the changes are lost. So... good to remember to syncItem()!

    2. That should be fine. The same object is kept around... if it is updated, then the same instance of the object will be updated.

    FYI .itemWasUpdated() is called after the underlying SyncRecord is updated. It will reload the object fields from SyncRecord/info. But the object instance should be the same.

    So, questions answered. Thanks.

  2. Stuart Beesley (Mr Toolbox) closed this discussion on 25 Jul, 2021 12:29 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac