From: derek Date: Mon, 13 Jul 2020 04:19:34 +0000 (-0400) Subject: ui.components: fix selector components to work with browser buttons X-Git-Url: http://these/git/%7B%60%24%7BarchiveUrl%7D/static/%7BfrontRss%7D?a=commitdiff_plain;h=47548905ce1b20035ffa467391f06280b6fbfcb4;p=lemmy.git ui.components: fix selector components to work with browser buttons Use getDerivedState to set state and only send back props --- diff --git a/ui/src/components/data-type-select.tsx b/ui/src/components/data-type-select.tsx index f2539c81..8e905bf4 100644 --- a/ui/src/components/data-type-select.tsx +++ b/ui/src/components/data-type-select.tsx @@ -25,6 +25,12 @@ export class DataTypeSelect extends Component< this.state = this.emptyState; } + static getDerivedStateFromProps(props) { + return { + type_: props.type_, + }; + } + render() { return (
@@ -42,8 +48,9 @@ export class DataTypeSelect extends Component< {i18n.t('posts')}