diff --git a/client/homebrew/pages/archivePage/archivePage.jsx b/client/homebrew/pages/archivePage/archivePage.jsx
index 8e2300851..88fbc05aa 100644
--- a/client/homebrew/pages/archivePage/archivePage.jsx
+++ b/client/homebrew/pages/archivePage/archivePage.jsx
@@ -41,7 +41,7 @@ const ArchivePage = createClass({
};
},
componentDidMount : function() {
-
+ this.loadPage(this.state.page, false);
},
updateStateWithBrews : function (brews, page, totalPages, totalBrews) {
@@ -55,19 +55,47 @@ const ArchivePage = createClass({
},
updateStateWithForm : function() {
+ const title = document.getElementById( 'title' ).value || "";
+ const size = document.getElementById( 'size' ).value || 10;
+ const page = 1;
+ const v3 = document.getElementById('v3').checked;
+ const legacy = document.getElementById('legacy').checked;
+
this.setState({
- title: document.getElementById( 'title' ).value || "",
- pageSize: document.getElementById( 'size' ).value || 10,
- v3: document.getElementById('v3').checked,
- legacy: document.getElementById('legacy').checked,
+ title: title,
+ pageSize: size,
+ v3: v3,
+ legacy: legacy
});
+ this.updateUrl(title, page, size, v3, legacy);
+ },
+
+
+ updateUrl : function(title, page, size, v3, legacy) {
+ const url = new URL(window.location.href);
+ const urlParams = new URLSearchParams(url.search);
+
+ //clean all params
+ urlParams.delete('title');
+ urlParams.delete('page');
+ urlParams.delete('size');
+ urlParams.delete('v3');
+ urlParams.delete('legacy');
+
+ urlParams.set('title', title);
+ urlParams.set('page', page);
+ urlParams.set('size', size);
+ urlParams.set('v3', v3);
+ urlParams.set('legacy', legacy);
+
+
+ url.search = urlParams.toString(); // Convert URLSearchParams to string
+ window.history.replaceState(null, null, url);
},
loadPage : async function(page, update) {
- console.log(update);
if(update === true) {
this.updateStateWithForm();
- this.updateUrl();
};
try {
@@ -89,27 +117,108 @@ const ArchivePage = createClass({
}
},
- updateUrl : function() {
- const url = new URL(window.location.href);
- const urlParams = new URLSearchParams(url.search);
-
- urlParams.set('title', this.state.title);
- urlParams.set('page', this.state.page);
- urlParams.set('pageSize', this.state.pageSize);
- urlParams.set('v3', this.state.v3);
- urlParams.set('legacy', this.state.legacy);
-
+ renderNavItems : function () {
+ return (
+