Description
Right now, a call to endpoint.initiate(..., { subscribe: false })
has the following behaviour:
- dispatches pending, does not create a cache entry
- dispatches fulfilled, updates cache entry if one exists
- returns a promise of the result of
selector(...)(getState())
While this is great for just updating an existing state value without actually subscribing (we use it for refetch
), it will return an uninitialized state if there never was a cache entry before. That part, I would consider a bug.
We could have it return the fulfilled action itself (#1277 would guarantee that we always have one of those, even in "skipped, because pending" scenarios), but that would change the general return value.
We could also just change the signature of { subscribe: false }
to always return void
. I would consider that valid, too.
In both of these cases, we should probably change LazyQuery in #1280 to always subscribe to state. Since that was never properly exposed and a bug at the given time, that could still be a "bug fix" and not a "breaking change".