Currently for async data I use the next structure:
{
isPending: true,
data: null,
error: null,
};
I think that adding fetched will be beneficial for couple of reasons:
we can legitimately get null as a result, so data field can contain it after performing action
it is much easier to use it inside shouldBeFetched. Also, if the user uses our middleware (or provides promises storage to thunk), we can safely delegate isPending check to the promisesStorage.
Currently for async data I use the next structure:
I think that adding
fetched
will be beneficial for couple of reasons:null
as a result, sodata
field can contain it after performing actionshouldBeFetched
. Also, if the user uses our middleware (or provides promises storage to thunk), we can safely delegateisPending
check to the promisesStorage.