Fixed: Cursor Jumps to end in when editing search term

Fixes #290
pull/429/head
Qstick 3 years ago
parent b7731faedc
commit 635fa78da9

@ -27,7 +27,7 @@ class SearchFooter extends Component {
this.state = {
searchingReleases: false,
searchQuery: defaultSearchQuery,
searchQuery: defaultSearchQuery || '',
searchIndexerIds: defaultIndexerIds,
searchCategories: defaultCategories
};
@ -52,14 +52,12 @@ class SearchFooter extends Component {
isFetching,
defaultIndexerIds,
defaultCategories,
defaultSearchQuery,
searchError
} = this.props;
const {
searchIndexerIds,
searchCategories,
searchQuery
searchCategories
} = this.state;
const newState = {};
@ -72,10 +70,6 @@ class SearchFooter extends Component {
newState.searchCategories = defaultCategories;
}
if (searchQuery !== defaultSearchQuery) {
newState.searchQuery = defaultSearchQuery;
}
if (prevProps.isFetching && !isFetching && !searchError) {
newState.searchingReleases = false;
}
@ -92,6 +86,10 @@ class SearchFooter extends Component {
this.props.onSearchPress(this.state.searchQuery, this.state.searchIndexerIds, this.state.searchCategories);
}
onSearchInputChange = ({ value }) => {
this.setState({ searchQuery: value });
}
//
// Render
@ -121,7 +119,7 @@ class SearchFooter extends Component {
autoFocus={true}
value={searchQuery}
isDisabled={isFetching}
onChange={onInputChange}
onChange={this.onSearchInputChange}
/>
</div>

Loading…
Cancel
Save