1import { useEffect } from 'react';
2import { difference } from 'lodash';
4import { usePointCache } from 'store/pointCache';
5import usePreviousValue from 'lib/usePreviousValue';
7const buildSyncHook = getFn =>
8 function SyncPoint(points = []) {
10 const prevPoints = usePreviousValue(points);
13 // sync points that are new between renders
14 const newPoints = difference(points, prevPoints);
15 Promise.all(newPoints.map(fn));
16 }, [fn, prevPoints, points]);
19export const useSyncDates = buildSyncHook(function() {
20 const { syncDates } = usePointCache();
24export const useSyncDetails = buildSyncHook(function() {
25 const { syncDetails } = usePointCache();
29export const useSyncExtras = buildSyncHook(function() {
30 const { syncExtras } = usePointCache();
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