diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-11-09 13:01:25 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-11-09 13:01:25 +0100 |
commit | 77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2 (patch) | |
tree | 8a13e6257146dc6a535dca220f7cb374cbd91a73 /web/src/js/urlState.js | |
parent | a0ddedff6f2e6420ab44a7763132e80a8b8075d5 (diff) | |
download | mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.tar.gz mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.tar.bz2 mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.zip |
mitmweb: minor fixes
Diffstat (limited to 'web/src/js/urlState.js')
-rw-r--r-- | web/src/js/urlState.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/web/src/js/urlState.js b/web/src/js/urlState.js index 77b39393..ca9187b2 100644 --- a/web/src/js/urlState.js +++ b/web/src/js/urlState.js @@ -1,3 +1,10 @@ +/** + * Instead of dealing with react-router's ever-changing APIs, + * we use a simple url state manager where we only + * + * - read the initial URL state on page load + * - push updates to the URL later on. + */ import { select, setFilter, setHighlight } from "./ducks/flows" import { selectTab } from "./ducks/ui/flow" import { toggleVisibility } from "./ducks/eventLog" @@ -65,9 +72,8 @@ function updateUrlFromStore(store) { if (queryStr) { url += "?" + queryStr } - if (window.location.hash !== url) { - // FIXME: replace state - window.location.hash = url + if (window.location.hash.substr(1) !== url) { + history.replaceState(undefined, "", `/#${url}`) } } |