mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
This commit is contained in:
parent
26ce102113
commit
dd34b155b4
@ -262,19 +262,14 @@ class Dialog extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
let selectedItemId = null;
|
||||
const itemIndex = this.selectedItemIndex(results, this.state.selectedItemId);
|
||||
if (itemIndex > 0) {
|
||||
selectedItemId = this.state.selectedItemId;
|
||||
} else if (results.length > 0) {
|
||||
selectedItemId = results[0].id;
|
||||
}
|
||||
// make list scroll to top in every search
|
||||
this.itemListRef.current.makeItemIndexVisible(0);
|
||||
|
||||
this.setState({
|
||||
listType: listType,
|
||||
results: results,
|
||||
keywords: this.keywords(searchQuery),
|
||||
selectedItemId: selectedItemId,
|
||||
selectedItemId: results.length === 0 ? null : results[0].id,
|
||||
resultsInBody: resultsInBody,
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user