mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
Fix cleanup_event_queue being called multiple times during reload.
Apparently it isn't always the case that removal of jquery and the DOM prevents cleanup_event_queue from being called via the postunload hook, so add a check to avoid it being double-called.
This commit is contained in:
parent
59e2be2f5f
commit
6d2ae9abbc
@ -150,8 +150,8 @@ function cleanup_before_reload() {
|
||||
// Free all the DOM in the main_div
|
||||
$("#main_div").empty();
|
||||
|
||||
// Now that the DOM is empty our beforeunload callback has been
|
||||
// removed.
|
||||
// Now that the DOM is empty our beforeunload callback may
|
||||
// have been removed, so explicitly remove event queue here.
|
||||
server_events.cleanup_event_queue();
|
||||
|
||||
// Empty the large collections
|
||||
|
||||
@ -379,6 +379,8 @@ exports.cleanup_event_queue = function cleanup_event_queue() {
|
||||
if (page_params.event_queue_expired === true) {
|
||||
return;
|
||||
}
|
||||
// Set expired because in a reload we may be called twice.
|
||||
page_params.event_queue_expired = true;
|
||||
channel.del({
|
||||
url: '/json/events',
|
||||
data: {queue_id: page_params.event_queue_id}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user