1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 10:50:24 +00:00

remove wrong logic about selected path (#6887)

* remove wrong logic about selected path

* change function name

---------

Co-authored-by: zhouwenxuan <aries@Mac.local>
Co-authored-by: Michael An <2331806369@qq.com>
This commit is contained in:
Aries
2024-10-14 09:57:11 +08:00
committed by GitHub
parent df29823634
commit 52cccb5ce9
2 changed files with 4 additions and 12 deletions

View File

@@ -42,7 +42,6 @@ class SelectDirentBody extends React.Component {
try {
const res = await seafileAPI.getRepoInfo(this.props.repoID);
const repoInfo = new RepoInfo(res.data);
this.props.setSelectedPath('/');
this.setState({
currentRepoInfo: repoInfo,
selectedRepo: repoInfo,
@@ -60,9 +59,6 @@ class SelectDirentBody extends React.Component {
const repoList = repos.filter((repo) => repo.permission === 'rw' && repo.repo_id !== this.props.repoID);
const sortedRepoList = Utils.sortRepos(repoList, 'name', 'asc');
const selectedRepo = sortedRepoList.find((repo) => repo.repo_id === this.props.repoID);
const path = this.props.path.substring(0, this.props.path.length - 1);
this.props.setSelectedPath(path);
this.setState({
repoList: sortedRepoList,
selectedRepo: selectedRepo || this.state.selectedRepo,
@@ -92,10 +88,6 @@ class SelectDirentBody extends React.Component {
});
};
selectPath = (path) => {
this.props.setSelectedPath(path);
};
setBrowsingPath = (path) => {
this.setState({ browsingPath: path });
};
@@ -158,7 +150,7 @@ class SelectDirentBody extends React.Component {
onDirentItemClick={this.onDirentItemClick}
selectSearchedItem={this.selectSearchedItem}
selectRepo={this.onSelectSearchedRepo}
selectPath={this.selectPath}
setSelectedPath={this.props.setSelectedPath}
setBrowsingPath={this.setBrowsingPath}
/>
)}

View File

@@ -20,7 +20,7 @@ export const SearchStatus = {
BROWSING: 'browsing',
};
const Searcher = ({ searchStatus, onUpdateSearchStatus, onDirentItemClick, selectSearchedItem, selectRepo, selectPath, setBrowsingPath }) => {
const Searcher = ({ searchStatus, onUpdateSearchStatus, onDirentItemClick, selectSearchedItem, selectRepo, setSelectedPath, setBrowsingPath }) => {
const [inputValue, setInputValue] = useState('');
const [isResultsPopoverOpen, setIsResultsPopoverOpen] = useState(false);
const [searchResults, setSearchResults] = useState([]);
@@ -125,7 +125,7 @@ const Searcher = ({ searchStatus, onUpdateSearchStatus, onDirentItemClick, selec
const repoInfo = new RepoInfo(res.data);
const path = item.path.substring(0, item.path.length - 1);
selectRepo(repoInfo);
selectPath(path);
setSelectedPath(path);
setBrowsingPath(item.path.substring(0, item.path.length - 1));
}).catch(err => {
const errMessage = Utils.getErrorMsg(err);
@@ -199,7 +199,7 @@ Searcher.propTypes = {
onDirentItemClick: PropTypes.func,
selectSearchedItem: PropTypes.func,
selectRepo: PropTypes.func,
selectPath: PropTypes.func,
setSelectedPath: PropTypes.func,
setBrowsingPath: PropTypes.func,
};