From 7671787a6352d0beaac8c4d0ef1276a59cf69aba Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Sun, 23 Jul 2017 15:49:56 +0700 Subject: [PATCH] Fix refresh after scrolly history changes --- CHANGELOG.md | 1 + ui/js/actions/app.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a37a87df..db625587e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Web UI version numbers should always match the corresponding version of LBRY App * Fixed files on downloaded tab not showing download progress * Fixed downloading files that are deleted not being removed from the downloading list * Fixed download progress bar not being cleared when a downloading file is deleted + * Fixed refresh regression after adding scroll position to history state ### Deprecated * diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js index d5014d9ad..871607778 100644 --- a/ui/js/actions/app.js +++ b/ui/js/actions/app.js @@ -14,6 +14,7 @@ import { doFetchDaemonSettings } from "actions/settings"; import { doAuthenticate } from "actions/user"; import { doFileList } from "actions/file_info"; import { toQueryString } from "util/query_params"; +import { parseQueryParams } from "util/query_params"; const { remote, ipcRenderer, shell } = require("electron"); const path = require("path"); @@ -63,6 +64,7 @@ export function doChangePath(path, options = {}) { export function doHistoryBack() { return function(dispatch, getState) { if (!history.state) return; + if (history.state.index === 0) return; history.back(); }; @@ -249,7 +251,9 @@ export function doAlertError(errorList) { export function doDaemonReady() { return function(dispatch, getState) { - history.replaceState({}, document.title, `#/discover`); + const path = window.location.hash || "#/discover"; + const params = parseQueryParams(path.split("?")[1] || ""); + history.replaceState({ params, index: 0 }, document.title, `${path}`); dispatch(doAuthenticate()); dispatch({ type: types.DAEMON_READY, -- 2.45.2