UA-17470720-3

Jump to content


Photo
- - - - -

Asynchronous datastores & failure handling


  • Please log in to reply
3 replies to this topic

#1 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 03 December 2013 - 02:57 AM

Hello,

 

At this moment, STV does not handle failure event of operations on asynchronous stores.

 

Ex If we delete a row on an arrayofobjectssection (bound to a network datastore) and the delete request fails. STV assumes the row has been deleted successfully, when in fact is has not been deleted.

 

I think that this kind of events should be handled (insert, delete, move, update) ,and run appropriate cell, section, or model actions.

 

Furthermore, it would be great to know when a datastore's asynchronous operation starts or ends, so we could present an activity indicator.

 


  • wizgod likes this

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 03 December 2013 - 03:09 PM

Hi Aris,

 

Regarding the failure errors, you can currently have access to these by subclassing your own SCWebServiceStore class and overriding methods such as asynchronousDeleteObject:success:failure:. Having said that, you definitely have a point here that this should be made a lot easier by implementing some actions for it like we did with fetchItemsFromStoreFailed. We'll make sure to add the extra actions in our very next release.

 

As for the asynchronous operations cycle, we already have these in place:

 

- Before async operation starts: willInsertItem, willUpdateItem, willDeleteItem

- When operation is successful: didInsertItem, didUpdateItem, didDeleteItem

 

Thank you very much for your feedback!



#3 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 04 December 2013 - 01:31 AM

Hi Tarek,

 

Please take a look at -[SCArrayOfItemsSection dispatchEventRemoveRowAtIndexPath:] . You'll find this piece of code

...

        case SCStoreModeAsynchronous:

            [self.dataStore asynchronousDeleteObject:object success:nil failure:nil];

            break;

.... code continues ....

.... deletes the row from the tableview ...

...

 

 

You don't actually wait  for the asynchronous operations' result, before removing the row from the tableview.

 

Even if I subclass SCWebServiceStore I will still have that bug. 

 

Thanks.


  • Tarek likes this

#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 December 2013 - 09:43 AM

Hi Arox,

 

Yes, this makes sense. We'll also be addressing this in our next release. Many thanks for all your feedback.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users