From 47548905ce1b20035ffa467391f06280b6fbfcb4 Mon Sep 17 00:00:00 2001
From: derek <wwsage@gmail.com>
Date: Mon, 13 Jul 2020 00:19:34 -0400
Subject: ui.components: fix selector components to work with browser buttons

Use getDerivedState to set state and only send back props
---
 ui/src/components/sort-select.tsx | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'ui/src/components/sort-select.tsx')

diff --git a/ui/src/components/sort-select.tsx b/ui/src/components/sort-select.tsx
index 05abdb20..22942d1b 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) {
+    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);
   }
 }
-- 
cgit v1.2.3


From 563a66b053dfbb189193f18775c15180eb36bd7d Mon Sep 17 00:00:00 2001
From: derek <wwsage@gmail.com>
Date: Mon, 13 Jul 2020 00:55:26 -0400
Subject: ui.components.sort-select: always parse to number

---
 ui/src/components/sort-select.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'ui/src/components/sort-select.tsx')

diff --git a/ui/src/components/sort-select.tsx b/ui/src/components/sort-select.tsx
index 22942d1b..736cbb30 100644
--- a/ui/src/components/sort-select.tsx
+++ b/ui/src/components/sort-select.tsx
@@ -24,8 +24,9 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
   }
 
   static getDerivedStateFromProps(props) {
+    console.log('sort-select', props);
     return {
-      sort: props.sort,
+      sort: Number(props.sort),
     };
   }
 
-- 
cgit v1.2.3


From ef62f4698a62e996bcd54faa1f360eff89b8ac4b Mon Sep 17 00:00:00 2001
From: derek <wwsage@gmail.com>
Date: Tue, 14 Jul 2020 01:13:43 -0400
Subject: ui.components: fix ts types, move user pagination to user details

---
 ui/src/components/sort-select.tsx | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'ui/src/components/sort-select.tsx')

diff --git a/ui/src/components/sort-select.tsx b/ui/src/components/sort-select.tsx
index 736cbb30..33d65819 100644
--- a/ui/src/components/sort-select.tsx
+++ b/ui/src/components/sort-select.tsx
@@ -23,10 +23,9 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
     this.state = this.emptyState;
   }
 
-  static getDerivedStateFromProps(props) {
-    console.log('sort-select', props);
+  static getDerivedStateFromProps(props: any): SortSelectState {
     return {
-      sort: Number(props.sort),
+      sort: props.sort,
     };
   }
 
-- 
cgit v1.2.3

