8import * as azimuth from 'azimuth-js';
10import { useNetwork } from './network';
12export const PointCacheContext = createContext(null);
14function _usePointCache() {
15 const { contracts } = useNetwork();
16 const [pointCache, _setPointCache] = useState({});
18 const addToPointCache = useCallback(
19 entry => _setPointCache(cache => ({ ...cache, ...entry })),
23 const fetchPoint = useCallback(
25 const _contracts = contracts.getOrElse(null);
30 const details = await azimuth.azimuth.getPoint(_contracts, point);
31 addToPointCache({ [point]: details });
33 [contracts, addToPointCache]
43export function PointCacheProvider({ children }) {
44 const pointCache = _usePointCache();
47 <PointCacheContext.Provider value={pointCache}>
49 </PointCacheContext.Provider>
54export function usePointCache() {
55 return useContext(PointCacheContext);
59export const withPointCache = Component =>
60 forwardRef((props, ref) => (
61 <PointCacheContext.Consumer>
62 {pointCache => <Component ref={ref} {...pointCache} {...props} />}
63 </PointCacheContext.Consumer>
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