diff options
Diffstat (limited to 'ui/src/components/sort-select.tsx')
-rw-r--r-- | ui/src/components/sort-select.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/src/components/sort-select.tsx b/ui/src/components/sort-select.tsx index 05abdb20..33d65819 100644 --- a/ui/src/components/sort-select.tsx +++ b/ui/src/components/sort-select.tsx @@ -23,6 +23,12 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> { this.state = this.emptyState; } + static getDerivedStateFromProps(props: any): SortSelectState { + return { + sort: props.sort, + }; + } + render() { return ( <> @@ -59,8 +65,6 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> { } handleSortChange(i: SortSelect, event: any) { - i.state.sort = Number(event.target.value); - i.setState(i.state); - i.props.onChange(i.state.sort); + i.props.onChange(event.target.value); } } |