loader.js: Push current state to history only on `onComplete`.

- Previously, in case of `abort` the url was already pushed to history at the beginning of `onFailure`, setting `addToHistory` to true only prevents it from being added twice (again in `onComplete`).
- Now we only push the url to history in `onComplete`, so setting `addToHistory` to false is only necessary if req is scripted.
- We intentionally push the canceled url into history to continue navigating with the browser`s back/forward key.
This commit is contained in:
Sukhwinder Dhillon 2023-07-06 14:11:17 +02:00 committed by Johannes Meyer
parent d794439537
commit 9dd21841a3
1 changed files with 3 additions and 3 deletions

View File

@ -1061,7 +1061,6 @@
if (req.addToHistory && ! req.autorefresh) {
req.$target.data('icingaRefresh', 0);
req.$target.data('icingaUrl', url);
icinga.history.pushCurrentState();
}
if (typeof req.progressTimer !== 'undefined') {
@ -1090,8 +1089,9 @@
req.$target
);
// Aborted requests should not be added to browser history
req.addToHistory = false;
if (req.scripted) {
req.addToHistory = false;
}
} else {
if (this.failureNotice === null) {
var now = new Date();