When we use a fetch to "subscribe" to new data, cancel it if in progress at DEAD_QUEUE
time.
#5609
Labels
a-data-sync
Zulip's event system, event queues, staleness/liveness
blocked on other work
To come back to after another related PR, or some other task.
Often, we initialize a model with data from
REGISTER_COMPLETE
, then just listen for events and use them to update the model.Sometimes, though, we "initialize" data in a model with the result of a non-initial fetch (like
GET /messages
), then we listen for events that affect the fetched data. The most famous example of this pattern is fetching messages; see https://github.com/zulip/zulip-mobile/blob/main/docs/architecture/realtime.md and https://zulip.readthedocs.io/en/latest/subsystems/events-system.html .When we're using this pattern, we should cancel the fetch synchronously with dispatching the
DEAD_QUEUE
action, so that:REGISTER_COMPLETE
.We should also cancel these fetches when the active, logged-in account changes; that's #5009.
When canceling a fetch, we shouldn't forget to update any metadata that tracks its state, like
state.fetching
.I believe these are the fetches we use this pattern with:
api.getMessages
api.getTopics
api.reportPresence
(to subscribe to users that didn't exist atREGISTER_COMPLETE
time)Issues #4170 and #4659 cover parts of how we might do this. Marking as blocked on those.
The text was updated successfully, but these errors were encountered: