Allow more specification to the loading status behavior #39
Labels
proposal
This contains a proposal for a feature or fix. This work may be subject to be discarded.
Milestone
@pearlzhuzeng had experienced an unexpected result regarding the
LOADING
status when developing the ReSift Rentals demo.The demo is application is structured like Netflix's list of lists of movies. She had a few fetches that we were shared and they were also using the newer "merges across namespaces" feature.
The issue and question is: what is the status of a fetch that has a share across a namespace?
Here's the scenario, you have three fetches with two different namespaces:
makeGetGenre
- a fetch factory that gets a list of movies. namespace:genre
makeGetMovie
- a fetch factory that gets a single movie. namespace:movie
makeUpdateMovie
- a fetch factory that updates a single movie. namespace:movie
makeGetGenre
implements a merge for the namespacemovie
so that when a movie item changes, the genre list changes to reflect that change.The question is, what is the status of a genre when a movie is inflight?
Through the current implementation, the output of
isLoading
istrue
.With this behavior, whenever any movie goes inflight, it will cause all lists to have the status
LOADING
. This is because the genre namespace doesn't know which movie belongs to which genre (and you can't know ahead of time).This can be confusing to the developer because an update to a movie in a different genre would cause all the genres to update (which is what @pearlzhuzeng experienced). I think this behavior should not be the default and we should add other behavior options.
The proposal is to remove the option
isolatedStatus
and replace it withtype
.The possible types of values of
type
will be:self
- only consider the status of the current fetch factory + keynamespace
- only consider the statuses of all fetches related the current namespace + keyall
- consider the statuses of all the fetches related to the current namespace + key as well as any other namespace (e.g.genre
namespace andmovie
).I think the default type for
useStatus
should benamespace
.That's it! Let me know if you need any further clarification. I think @pearlzhuzeng knows what I'm talking about though.
The text was updated successfully, but these errors were encountered: