1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

fix bug - move file to searched folder failed (#7247)

Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
Aries
2024-12-24 16:41:46 +08:00
committed by GitHub
parent 9c06206584
commit 336e1fa193
2 changed files with 20 additions and 8 deletions

View File

@@ -223,9 +223,14 @@ class CopyDirent extends React.Component {
};
onUpdateSearchResults = (results) => {
this.setState({
searchResults: results
});
if (results.length > 0) {
const firstResult = results[0];
this.setState({
selectedRepo: new RepoInfo(firstResult),
selectedPath: firstResult.path
});
}
this.setState({ searchResults: results });
};
onOpenSearchBar = () => {
@@ -240,6 +245,7 @@ class CopyDirent extends React.Component {
searchResults: [],
selectedSearchedRepo: null,
showSearchBar: false,
selectedPath: this.props.path,
initToShowChildren: mode === MODE_TYPE_MAP.ONLY_CURRENT_LIBRARY,
});
};
@@ -279,7 +285,7 @@ class CopyDirent extends React.Component {
onDirentItemClick = (repo, selectedPath) => {
this.setState({
repo: repo,
selectedRepo: repo,
selectedPath: selectedPath,
errMessage: ''
});

View File

@@ -236,15 +236,20 @@ class MoveDirent extends React.Component {
};
onUpdateSearchResults = (results) => {
this.setState({
searchResults: results
});
if (results.length > 0) {
const firstResult = results[0];
this.setState({
selectedRepo: new RepoInfo(firstResult),
selectedPath: firstResult.path
});
}
this.setState({ searchResults: results });
};
onDirentItemClick = (repo, selectedPath) => {
this.setState({
selectedPath: selectedPath,
repo,
selectedRepo: repo,
errMessage: '',
});
};
@@ -261,6 +266,7 @@ class MoveDirent extends React.Component {
searchResults: [],
selectedSearchedRepo: null,
showSearchBar: false,
selectedPath: this.props.path,
initToShowChildren: mode === MODE_TYPE_MAP.ONLY_CURRENT_LIBRARY,
});
};