Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fetchActions: Use
loading
instead of needsInitialFetch
.
`needsInitialFetch` really belongs to the brittle `AppDataFetcher` subsystem, and we've long wanted to replace that with something more robust, to reduce the amount of nonlocal reasoning we have to do in the initial fetch logic. It seems likely that the old code was trying to say, "Don't do a `fetchOlder` or `fetchNewer` when an initial fetch is in progress". And `loading` is a better way of saying "an initial fetch is in progress". Greg summarizes why we shouldn't expect this to change behavior in a disruptive way [1]: > The key points are: > > * `needsInitialFetch` is never false when `loading` is true > * whenever `needsInitialFetch` is true and `loading` isn't, > `AppDataFetcher` will immediately cause `loading` to become true > * so at most, this means > > we pretty minimally extend the existing window during which > > it's possible for this code to start a message fetch that ends > > up still being in progress when an initial fetch starts. > > It's a bug, and a potential source of wrong data, that that window > exists -- or rather, that we don't cancel that earlier message > fetch and may use its results, which are potentially missing > updates that happened before we created our new event queue. But > this change doesn't meaningfully expand that bug, and it helps us > toward simplifying the `needsInitialFetch` / `AppDataFetcher` > logic. [1] zulip#5003 (comment)
- Loading branch information