on master help sign in
Tighten up outgoing points finding logic
13d83c1Fang
src/views/Points.js+11−13
@@ -88,19 +88,16 @@ export default function Points() {
88 addRejectedPoint,
88 addRejectedPoint,
89 ] = useRejectedIncomingPointTransfers();
89 ] = useRejectedIncomingPointTransfers();
90
90
91− const maybeOutgoingPoints = useMemo(() => {
91+ const maybeOutgoingPoints = useMemo(
92+ () =>
92− return controlledPoints.matchWith({
93+ controlledPoints.chain(points =>
93− Nothing: () => Nothing(),
94− Just: r =>
95− r.value.matchWith({
94+ points.matchWith({
96 Error: () => Nothing(),
95 Error: () => Nothing(),
97 Ok: c => {
96 Ok: c => {
98 const points = c.value.ownedPoints.map(point =>
97 const points = c.value.ownedPoints.map(point =>
99− getDetails(point).matchWith({
98+ getDetails(point).chain(details =>
100− Nothing: () => Nothing(),
101− Just: p =>
102− Just({ point: point, has: hasTransferProxy(p.value) }),
99+ Just({ point: point, has: hasTransferProxy(details) })
103− })
100+ )
104 );
101 );
105 // if we have details for every point,
102 // if we have details for every point,
106 // return the array of pending transfers.
103 // return the array of pending transfers.
@@ -113,9 +110,10 @@ export default function Points() {
113 return Nothing();
110 return Nothing();
114 }
111 }
115 },
112 },
116− }),
113+ })
117− });
114+ ),
118− }, [getDetails, controlledPoints]);
115+ [getDetails, controlledPoints]
116+ );
119
117
120 // if we can only interact with a single point, forget about the existence
118 // if we can only interact with a single point, forget about the existence
121 // of this page and jump to the point page.
119 // of this page and jump to the point page.