1import { useState, useCallback } from 'react';
2import { Just, Nothing } from 'folktale/maybe';
3import * as azimuth from 'azimuth-js';
5import { useNetwork } from '../network';
7export default function useDetailsStore() {
8 const { contracts } = useNetwork();
9 const [detailsCache, _setDetailsCache] = useState({});
11 const addToDetails = useCallback(
13 _setDetailsCache(cache => ({
20 // TODO: refactor detailsCache access to use accessor like bithday
22 const getDetails = useCallback(
23 point => (point in detailsCache ? Just(detailsCache[point]) : Nothing()),
27 const syncDetails = useCallback(
29 const _contracts = contracts.getOrElse(null);
34 // fetch point details
35 const details = await azimuth.azimuth.getPoint(_contracts, point);
40 [contracts, addToDetails]
44 // TODO: refactor accessors to use getDetails instead of
45 // touching the cache directly
46 pointCache: detailsCache,
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list