Skip to content

Commit

Permalink
调整打包命令,增加cross-env依赖,修改初始渲染逻辑避免页面刷新不会默认展开面板
Browse files Browse the repository at this point in the history
  • Loading branch information
chengmingrui committed Apr 27, 2023
1 parent 9aa721c commit 278781f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
35 changes: 19 additions & 16 deletions content/src/scripts/containers/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,34 @@ class App extends Component {
}

render() {
const { tabId } = this.state;
const { tabId, firstPageLoad } = this.state;
if (!tabId) return null;
if (!this.shouldShowSpanTree()) {
if (this.props.opened[tabId]) this.toggleOpenedThisTab();
applyClosedPageStyling();
return null;
}

const { opened, width } = this.props;
if (!opened[tabId] && width && firstPageLoad) {
this.toggleOpenedThisTab();
}
return (
<Fragment>
<link rel="stylesheet" type="text/css" href={importFileIconCSS} />
{this.props.opened[tabId]
? ReactDOM.createPortal(
<Pane
toggleOpened={this.toggleOpenedThisTab}
width={this.props.width}
firstPageLoad={this.state.firstPageLoad}
setFirstPageLoad={this.setFirstPageLoad}
reloading={this.state.reloading}
setReloading={this.setReloading}
setShowSearchbarTrue={() => this.setShowSearchbar(true)}
/>,
parentDiv
)
: ReactDOM.createPortal(
{this.props.opened[tabId]
? ReactDOM.createPortal(
<Pane
toggleOpened={this.toggleOpenedThisTab}
width={this.props.width}
firstPageLoad={this.state.firstPageLoad}
setFirstPageLoad={this.setFirstPageLoad}
reloading={this.state.reloading}
setReloading={this.setReloading}
setShowSearchbarTrue={() => this.setShowSearchbar(true)}
/>,
parentDiv
)
:ReactDOM.createPortal(
<Toggler
handleClick={this.toggleOpenedThisTab}
pinned={this.props.pinned}
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Tree for Gitlab",
"scripts": {
"start": "gulp && gulp watch",
"export": "NODE_ENV=production npm start"
"export": "cross-env NODE_ENV=production && npm start",
"pack": "cross-env NODE_ENV=production && gulp"
},
"author": "Taveesh Anand",
"dependencies": {
Expand All @@ -28,6 +29,7 @@
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"cross-env": "7.0.3",
"css-loader": "^5.2.5",
"fancy-log": "^2.0.0",
"file-loader": "^6.0.0",
Expand Down

0 comments on commit 278781f

Please sign in to comment.