can-connect icon indicating copy to clipboard operation
can-connect copied to clipboard

fall-through-cache add isFromCache()-> Boolean on Lists ~13

Open justinbmeyer opened this issue 9 years ago • 5 comments
trafficstars

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.

justinbmeyer avatar Aug 31 '16 15:08 justinbmeyer

Does it have to be a method? How about a property that get's removed when it's not from cache?

BigAB avatar Aug 31 '16 16:08 BigAB

@BigAB that doesn't work with DefineMap very well. Also isSaving() isDestroying() isNew() are all methods.

justinbmeyer avatar Aug 31 '16 16:08 justinbmeyer

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.

justinbmeyer avatar Aug 31 '16 16:08 justinbmeyer

this also needs to be able to communicate if there's an error from the cache.

justinbmeyer avatar Sep 22 '16 22:09 justinbmeyer

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.

imjoshdean avatar Sep 27 '16 18:09 imjoshdean