Remove obsolete workaround for safari
authorMarcel Werk <burntime@woltlab.com>
Wed, 2 Aug 2023 15:15:47 +0000 (17:15 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 2 Aug 2023 15:15:47 +0000 (17:15 +0200)
See ecd2007f820c44673a9d6d51443032aaef91b78a
See https://www.woltlab.com/community/thread/300882-back-button-in-search-result-pagination-not-working-reliably/

ts/WoltLabSuite/Core/Ui/Search/Extended.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Extended.js

index 308a25e5c9f9c341956cadb3ae3eb8f8e598f2c8..42ad4c3fd63a3c84d43d2892dd40bda1bf823f38 100644 (file)
@@ -71,13 +71,7 @@ export class UiSearchExtended {
     });
     this.typeInput.addEventListener("change", () => this.changeType());
 
-    window.addEventListener("popstate", (event) => {
-      if (event.state.searchAction && event.state.searchAction === SearchAction.Init) {
-        // Safari fires the `popstate` for the initial request on
-        // navigation, causing the search to be dispatched twice.
-        return;
-      }
-
+    window.addEventListener("popstate", () => {
       this.initQueryString();
     });
   }
@@ -161,7 +155,7 @@ export class UiSearchExtended {
     if (this.activePage > 1) {
       parameters.push(["pageNo", this.activePage.toString()]);
     }
-    url.search += (new URLSearchParams(parameters)).toString();
+    url.search += new URLSearchParams(parameters).toString();
 
     if (searchAction === SearchAction.Init) {
       window.history.replaceState({ searchAction }, document.title, url.toString());
index c5e7b4b319d9db0db461b5250d878ce8ecc3a341..eda246577e606a9c5ddf01bc70c7ede1b8a7982e 100644 (file)
@@ -45,12 +45,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Date/Picker", "../..
                 void this.search(0 /* SearchAction.Modify */);
             });
             this.typeInput.addEventListener("change", () => this.changeType());
-            window.addEventListener("popstate", (event) => {
-                if (event.state.searchAction && event.state.searchAction === 2 /* SearchAction.Init */) {
-                    // Safari fires the `popstate` for the initial request on
-                    // navigation, causing the search to be dispatched twice.
-                    return;
-                }
+            window.addEventListener("popstate", () => {
                 this.initQueryString();
             });
         }
@@ -123,7 +118,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Date/Picker", "../..
             if (this.activePage > 1) {
                 parameters.push(["pageNo", this.activePage.toString()]);
             }
-            url.search += (new URLSearchParams(parameters)).toString();
+            url.search += new URLSearchParams(parameters).toString();
             if (searchAction === 2 /* SearchAction.Init */) {
                 window.history.replaceState({ searchAction }, document.title, url.toString());
             }