diff options
author | Dessalines <tyhou13@gmx.com> | 2020-07-14 11:26:16 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-07-14 11:26:16 -0400 |
commit | d6fdfe0b6d348e0c3da5deaf5beea329ff04f068 (patch) | |
tree | a8042afde4b1617f38b4e67fbdce33949680e3a5 /ui/src/components/sort-select.tsx | |
parent | 5ccf81349e18e100fb13c10b05921a7d9619ddd5 (diff) | |
parent | ef62f4698a62e996bcd54faa1f360eff89b8ac4b (diff) |
Merge branch 'fix_frontend_duplicate_requests' of https://github.com/masterstur/lemmy into masterstur-fix_frontend_duplicate_requests
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); } } |