mirror of https://github.com/zulip/zulip.git
channel: Discard all HTTP responses while reloading.
We used to have a block of code doing this just in the presence endpoint because that's where we'd had error-handling problems with it not being present, but it seems more correct for it to run unconditionally on all HTTP requests. This requires adding a dependency of channel on reload_state, which we record in the webpack configuration for now.
This commit is contained in:
parent
e20656e02a
commit
e2892a88c1
|
@ -2,6 +2,7 @@ set_global('blueslip', global.make_zblueslip());
|
|||
set_global('$', {});
|
||||
|
||||
set_global('reload', {});
|
||||
zrequire('reload_state');
|
||||
zrequire('channel');
|
||||
|
||||
|
||||
|
|
|
@ -323,11 +323,6 @@ function send_presence_to_server(want_redraw) {
|
|||
},
|
||||
idempotent: true,
|
||||
success: function (data) {
|
||||
if (reload_state.is_in_progress()) {
|
||||
blueslip.log("Ignoring presence response because reload in progress");
|
||||
return;
|
||||
}
|
||||
|
||||
// Update Zephyr mirror activity warning
|
||||
if (data.zephyr_mirror_active === false) {
|
||||
$('#zephyr-mirror-error').addClass("show");
|
||||
|
|
|
@ -49,6 +49,15 @@ function call(args, idempotent) {
|
|||
args.success = function wrapped_success(data, textStatus, jqXHR) {
|
||||
remove_pending_request(jqXHR);
|
||||
|
||||
if (reload_state.is_in_progress()) {
|
||||
// If we're in the process of reloading the browser,
|
||||
// there's no point in running the success handler,
|
||||
// because all of our state is about to be discarded
|
||||
// anyway.
|
||||
blueslip.log(`Ignoring ${args.type} ${args.url} response while reloading`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data && idempotent) {
|
||||
// If idempotent, retry
|
||||
blueslip.log("Retrying idempotent" + args);
|
||||
|
|
|
@ -37,6 +37,8 @@ EXEMPT_FILES = {
|
|||
'static/js/billing/helpers.js',
|
||||
'static/js/blueslip.js',
|
||||
'static/js/blueslip_stacktrace.ts',
|
||||
# Removed temporarily.
|
||||
'static/js/channel.js',
|
||||
'static/js/click_handlers.js',
|
||||
'static/js/compose_actions.js',
|
||||
'static/js/composebox_typeahead.js',
|
||||
|
|
|
@ -104,11 +104,13 @@
|
|||
"./static/js/bundles/portico.js",
|
||||
"./static/js/portico/integrations_dev_panel.js",
|
||||
"./static/styles/portico/integrations_dev_panel.css",
|
||||
"./static/js/reload_state.js",
|
||||
"./static/js/channel.js"
|
||||
],
|
||||
"email-log": [
|
||||
"./static/js/bundles/common.js",
|
||||
"./static/js/portico/email_log.js",
|
||||
"./static/js/reload_state.js",
|
||||
"./static/js/channel.js"
|
||||
],
|
||||
"stats": [
|
||||
|
|
Loading…
Reference in New Issue