From 1340f0927dd618c3cafc6932af12c2e9c4deea87 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Tue, 11 Feb 2020 08:27:01 +0100 Subject: [PATCH] Attempt to use hash history but this is not going to work. --- frontend/package.json | 1 + frontend/src/html/index.html | 3 +++ frontend/src/js/dialog/wb-browse-dialog.js | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index afc78ce..f2bd946 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,6 +4,7 @@ "bootstrap": "^4.4.1", "crypto-js": "^3.1.9-1", "filesize": "^6.0.1", + "history": "^4.10.1", "jquery": "^3.4.1", "js-uuid": "0.0.6", "linkstate": "^1.1.1", diff --git a/frontend/src/html/index.html b/frontend/src/html/index.html index e22169d..44421f6 100755 --- a/frontend/src/html/index.html +++ b/frontend/src/html/index.html @@ -4,6 +4,9 @@ + diff --git a/frontend/src/js/dialog/wb-browse-dialog.js b/frontend/src/js/dialog/wb-browse-dialog.js index 37c52bd..bddecec 100644 --- a/frontend/src/js/dialog/wb-browse-dialog.js +++ b/frontend/src/js/dialog/wb-browse-dialog.js @@ -2,11 +2,14 @@ import { h, Component } from 'preact'; import WBBrowseDialogProjectList from 'wb-browse-dialog-project-list'; import WBBrowseDialogCollectionList from 'wb-browse-dialog-project-list'; import linkState from 'linkstate'; +import { Router } from 'preact-router'; +import { createHashHistory } from 'history'; class WBBrowseDialog extends Component { constructor(...args) { super(...args); this.state.history = []; + this.state.history_1 = createHashHistory(); } resetSearch() { @@ -17,7 +20,7 @@ class WBBrowseDialog extends Component { } pushHistory(child) { - const { history } = this.state; + const { history, textSearch } = this.state; history.push([ child, { textSearch } ]); this.state.history = history.slice(history.length - 1000); } @@ -30,7 +33,7 @@ class WBBrowseDialog extends Component { entry[0].popHistory(); } - render({ app, id }, { mode, textSearch, textSearchInput }) { + render({ app, id }, { mode, textSearch, textSearchInput, history, history_1 }) { return (