From ca409b33e7550595d3ac2b50bb14b179237c13c9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 17 Apr 2024 13:38:22 +0200 Subject: [PATCH] Fix the order in which the previous XHR is registered See https://www.woltlab.com/community/thread/305578/ --- ts/WoltLabSuite/Core/Ajax/Request.ts | 8 ++++---- .../install/files/js/WoltLabSuite/Core/Ajax/Request.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ajax/Request.ts b/ts/WoltLabSuite/Core/Ajax/Request.ts index dc3978087f..9eef6c8c28 100644 --- a/ts/WoltLabSuite/Core/Ajax/Request.ts +++ b/ts/WoltLabSuite/Core/Ajax/Request.ts @@ -108,6 +108,10 @@ class AjaxRequest { * Dispatches a request, optionally aborting a currently active request. */ sendRequest(abortPrevious?: boolean): void { + if (this._xhr instanceof XMLHttpRequest) { + this._previousXhr = this._xhr; + } + if (abortPrevious || this._options.autoAbort) { this.abortPrevious(); } @@ -116,10 +120,6 @@ class AjaxRequest { AjaxStatus.show(); } - if (this._xhr instanceof XMLHttpRequest) { - this._previousXhr = this._xhr; - } - this._xhr = new XMLHttpRequest(); this._xhr.open(this._options.type!, this._options.url!, true); if (this._options.contentType) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js index 58014594e9..dd234cdcaf 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js @@ -85,15 +85,15 @@ define(["require", "exports", "tslib", "./Status", "../Core", "../Dom/Change/Lis * Dispatches a request, optionally aborting a currently active request. */ sendRequest(abortPrevious) { + if (this._xhr instanceof XMLHttpRequest) { + this._previousXhr = this._xhr; + } if (abortPrevious || this._options.autoAbort) { this.abortPrevious(); } if (!this._options.silent) { AjaxStatus.show(); } - if (this._xhr instanceof XMLHttpRequest) { - this._previousXhr = this._xhr; - } this._xhr = new XMLHttpRequest(); this._xhr.open(this._options.type, this._options.url, true); if (this._options.contentType) { -- 2.20.1