From e8982c22cadc8d1d4826f511bac364d4de5bfc49 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sun, 29 Sep 2019 17:57:57 +0800 Subject: [PATCH 1/2] {} --- public/react/src/modules/tpm/TPMRepositoryComponent.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMRepositoryComponent.js b/public/react/src/modules/tpm/TPMRepositoryComponent.js index c9735d46a..dd5c02489 100644 --- a/public/react/src/modules/tpm/TPMRepositoryComponent.js +++ b/public/react/src/modules/tpm/TPMRepositoryComponent.js @@ -15,6 +15,7 @@ import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor' class TPMRepositoryComponent extends Component { constructor(props) { super(props) + this.nameTypeMap = {} let pathArray = [] var splitArray = window.location.pathname.split('shixun_show/'); if (splitArray[1]) { @@ -38,7 +39,7 @@ class TPMRepositoryComponent extends Component { componentDidMount = () => { - this.nameTypeMap = {} + this.fetchRepo() } setContentWidth100 = (flag) => { From 95e6cea51bf5ae5e22b45a975d2a6d349bcd9594 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sun, 29 Sep 2019 18:01:41 +0800 Subject: [PATCH 2/2] 3 --- public/react/src/modules/tpm/TPMRepositoryComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMRepositoryComponent.js b/public/react/src/modules/tpm/TPMRepositoryComponent.js index dd5c02489..027f3f705 100644 --- a/public/react/src/modules/tpm/TPMRepositoryComponent.js +++ b/public/react/src/modules/tpm/TPMRepositoryComponent.js @@ -140,7 +140,7 @@ class TPMRepositoryComponent extends Component { let fileInPathArray = false; if (newPathArray.length) { fileInPathArray = this.nameTypeMap[newPathArray[newPathArray.length - 1]] ? this.nameTypeMap[newPathArray[newPathArray.length - 1]] !== 'tree' - : (listItem.type !== 'tree' && this._isFileName( newPathArray[newPathArray.length - 1] )) + : (listItem ? listItem.type !== 'tree' : this._isFileName( newPathArray[newPathArray.length - 1] )) if ( fileInPathArray ) { urlNewPathArray = newPathArray.slice(0, newPathArray.length - 1) }