on master help sign in
fix: update getDetails to correctly return Maybe and allow Actions to exist on Point.js
commit2af5239b9280575d55e33d6f2d0a68cd350ea664 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateWed 26 Jun 2019, 10:47 (7 years ago) parent0e6fe7a
3 files changed+7−8
src/store/lib/useDetailsStore.js+3−1 src/views/Point.js+2−2 src/views/Point/Actions.js+2−5
src/store/lib/useDetailsStore.js+3−1
@@ -18,8 +18,10 @@ export default function useDetailsStore() {
1818 );
1919
2020 // TODO: refactor detailsCache access to use accessor like bithday
21+ // Maybe<{}>
2122 const getDetails = useCallback(
22− point => detailsCache[point] || Maybe.Nothing(),
23+ point =>
24+ point in detailsCache ? Maybe.Just(detailsCache[point]) : Maybe.Nothing(),
2325 [detailsCache]
2426 );
2527
src/views/Point.js+2−2
@@ -48,9 +48,9 @@ export default function Point() {
4848 Boot Arvo
4949 </ForwardButton>
5050 </Grid.Item>
51− {/* <Grid.Item full>
51+ <Grid.Item full>
5252 <Actions />
53− </Grid.Item> */}
53+ </Grid.Item>
5454 </Grid>
5555
5656 <FooterButton onClick={goInvite}>
src/views/Point/Actions.js+2−5
@@ -1,5 +1,4 @@
11import React from 'react';
2−import Maybe from 'folktale/maybe';
32import { azimuth } from 'azimuth-js';
43import * as need from '../../lib/need';
54
@@ -21,10 +20,8 @@ function Actions(props) {
2120 const { wallet } = useWallet();
2221 const { pointCursor } = usePointCursor();
2322 const point = need.pointCursor(pointCursor);
24− const { pointCache } = usePointCache();
25− const pointDetails = Maybe.Just(
26− need.fromPointCache(Maybe.Just(pointCache), point)
27− );
23+ const { getDetails } = usePointCache();
24+ const pointDetails = getDetails(point);
2825
2926 const addr = need.addressFromWallet(wallet);
3027