From 05ebc4936befbc1fb60a078d1d267970189e724c Mon Sep 17 00:00:00 2001 From: shanshuirenjia <978987373@qq.com> Date: Mon, 22 Apr 2019 18:39:44 +0800 Subject: [PATCH] repair history.back bug --- frontend/src/wiki.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/wiki.js b/frontend/src/wiki.js index bac051ea0b..31dd093461 100644 --- a/frontend/src/wiki.js +++ b/frontend/src/wiki.js @@ -126,7 +126,11 @@ class Wiki extends Component { const hash = window.location.hash; let fileUrl = siteRoot + 'wikis/' + slug + Utils.encodePath(filePath) + hash; - window.history.pushState({url: fileUrl, path: filePath}, filePath, fileUrl); + if (filePath === '/home.md') { + window.history.replaceState({url: fileUrl, path: filePath}, filePath, fileUrl); + } else { + window.history.pushState({url: fileUrl, path: filePath}, filePath, fileUrl); + } } loadDirentList = (dirPath) => {