Skip to content

CollectionDataProvider.fetchDataFromCache can fail to set the cacheKey #58

@markkrenek

Description

@markkrenek

When calling CollectionDataProvider.fetchDataFromCache, If there are no objects in the cache matching the cache key, nil is returned for the object array (I might prefer an empty array), but more importantly, the cache key is not set on the provider, so even though you have a delegate listening to the data provider, it will not get notified of subsequent additions to the collection. Here's the sequence I'm doing:

collectionDataProvider = CollectionDataProvider<StoreItemPendingPurchase>()
collectionDataProvider.delegate = self
collectionDataProvider.fetchDataFromCache(withCacheKey: cacheKey)

This returns nil for the error and nil for the object array. And the data provider's cacheKey is still nil. If somewhere else in the app someone sets data on the same cacheKey, I don't find out about it because my data provider's cacheKey is still nil.

Is this expected? If there some way to set the cacheKey independently of using setData() or fetchDataFromCache()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions