on master help sign in
Tighten up outgoing points finding logic
commit13d83c1423ce50d0ba9623f6a2eccf58b9bfdbbf authorFang <git@fang.io> dateThu 8 Aug 2019, 09:11 (7 years ago) parentf6e93df
1 file changed+11−13
src/views/Points.js+11−13
src/views/Points.js+11−13
@@ -88,19 +88,16 @@ export default function Points() {
8888 addRejectedPoint,
8989 ] = useRejectedIncomingPointTransfers();
9090
91− const maybeOutgoingPoints = useMemo(() => {
92− return controlledPoints.matchWith({
93− Nothing: () => Nothing(),
94− Just: r =>
95− r.value.matchWith({
91+ const maybeOutgoingPoints = useMemo(
92+ () =>
93+ controlledPoints.chain(points =>
94+ points.matchWith({
9695 Error: () => Nothing(),
9796 Ok: c => {
9897 const points = c.value.ownedPoints.map(point =>
99− getDetails(point).matchWith({
100− Nothing: () => Nothing(),
101− Just: p =>
102− Just({ point: point, has: hasTransferProxy(p.value) }),
103− })
98+ getDetails(point).chain(details =>
99+ Just({ point: point, has: hasTransferProxy(details) })
100+ )
104101 );
105102 // if we have details for every point,
106103 // return the array of pending transfers.
@@ -113,9 +110,10 @@ export default function Points() {
113110 return Nothing();
114111 }
115112 },
116− }),
117− });
118− }, [getDetails, controlledPoints]);
113+ })
114+ ),
115+ [getDetails, controlledPoints]
116+ );
119117
120118 // if we can only interact with a single point, forget about the existence
121119 // of this page and jump to the point page.