can-connect
can-connect copied to clipboard
fall-through-cache add isFromCache()-> Boolean on Lists ~13
We need a way to know if the data is from the cache or not. This will let developers put the list in a "disabled" state until the real data has loaded.
I suggest an expando method on lists (and possibly instances) like:
todos.isFromCache()
This will be true if the todos is made up of data loaded from the cache. It will be false once data has loaded.
This will allow templates like:
<ul class="{{#todos.isFromCache}}cached{{/todos.isFomCache}}">
And allow for modifications to be disabled.
We should also be able to provide a rejected reason too.
Does it have to be a method? How about a property that get's removed when it's not from cache?
@BigAB that doesn't work with DefineMap very well. Also isSaving() isDestroying() isNew() are all methods.
Also, I don't think removing a property would be a good idea even if it worked. The property would just be set to false.
this also needs to be able to communicate if there's an error from the cache.
Communicating an error ended up being a property getting called inconsistencyReason which prompted me to change isFromCache to isConsistent in order to provide a unified name for Lists and Maps.