Skip to content

Commit

Permalink
Fixes an issue where folder search would not work in resrouce manager (
Browse files Browse the repository at this point in the history
…#4202)

Closes #4200

The filtering logic was applied with a null result and removing all the results, I added a check for null which makes the fileting work when the search is used.
  • Loading branch information
valadas committed Oct 16, 2020
1 parent 1b61172 commit fb38f8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ export default class FolderPicker extends React.Component {
if (this.unmounted) {
return;
}

const { props } = this;
let homeFolderId = props.homeFolderId;

let source = result.Tree;
let filtered = this.findNode(source, (n) => {return n !== null && n.data.key === homeFolderId.toString();});
source.children.splice(0, source.children.length, filtered);

if (filtered !== null){
source.children.splice(0, source.children.length, filtered);
}
this.setState({ folders: result.Tree });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default class FolderSelector extends Component {
const searchFolderText = e.target.value ? e.target.value : "";
this.setState({ searchFolderText });
clearTimeout(this.timeOut);
this.timeOut = setTimeout(() => {this.props.searchFolder(searchFolderText.toLowerCase());}, 500);
this.timeOut = setTimeout(() =>
this.props.searchFolder(searchFolderText.toLowerCase()),
500);
}

clearSearch(e) {
Expand Down Expand Up @@ -87,7 +89,7 @@ export default class FolderSelector extends Component {
<input
type="text"
value={this.state.searchFolderText}
onChange={this.onChangeSearchFolderText.bind(this) }
onChange={e => this.onChangeSearchFolderText(e) }
placeholder={searchFolderPlaceHolder}
aria-label="Search" />
{this.state.searchFolderText &&
Expand Down

0 comments on commit fb38f8d

Please sign in to comment.