on master help sign in
store: rename syncKnownPoint to syncDates

More accurately describes what data is being synced here.

commitd55748d941d817e635fafde47eeb2bec67e90cfc authorfang <git@fang.io> dateThu 24 Jun 2021, 20:28 (5 years ago) parent5eceb4e
5 files changed+14−20
src/lib/useSyncPoints.js+3−3 src/store/lib/usePointStore.js+5−6 src/views/Activate.js+2−4 src/views/CreateGalaxy.js+2−2 src/views/IssueChild.js+2−5
src/lib/useSyncPoints.js+3−3
@@ -16,9 +16,9 @@ const buildSyncHook = getFn =>
1616 }, [fn, prevPoints, points]);
1717 };
1818
19−export const useSyncKnownPoints = buildSyncHook(function() {
20− const { syncKnownPoint } = usePointCache();
21− return syncKnownPoint;
19+export const useSyncDates = buildSyncHook(function() {
20+ const { syncDates } = usePointCache();
21+ return syncDates;
2222});
2323
2424export const useSyncDetails = buildSyncHook(function() {
src/store/lib/usePointStore.js+5−6
@@ -20,8 +20,7 @@ export default function usePointStore() {
2020 const { syncResidents, syncResidentCount, ...residents } = useResidents();
2121 const ecliptic = useEclipticOwnerStore();
2222
23− //TODO more appropriately named "syncDates" or similar
24− const syncKnownPoint = useCallback(
23+ const syncDates = useCallback(
2524 async point => Promise.all([syncBirthday(point), syncRekeyDate(point)]),
2625 [syncBirthday, syncRekeyDate]
2726 );
@@ -29,13 +28,13 @@ export default function usePointStore() {
2928 const syncExtras = useCallback(
3029 async point =>
3130 Promise.all([
32− syncKnownPoint(point),
31+ syncDetails(point),
3332 //
33+ syncDates(point),
3434 syncResidentCount(point),
35− syncDetails(point),
3635 syncInvites(point),
3736 ]),
38− [syncKnownPoint, syncDetails, syncInvites, syncResidentCount]
37+ [syncDates, syncDetails, syncInvites, syncResidentCount]
3938 );
4039
4140 return {
@@ -50,7 +49,7 @@ export default function usePointStore() {
5049 syncRekeyDate,
5150 syncInvites,
5251 syncControlledPoints,
53− syncKnownPoint,
52+ syncDates,
5453 syncResidents,
5554 syncExtras,
5655 };
src/views/Activate.js+2−4
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
22
33import useRouter from 'lib/useRouter';
44import { LocalRouterProvider } from 'lib/LocalRouter';
5−import { useSyncKnownPoints } from 'lib/useSyncPoints';
5+import { useSyncDates } from 'lib/useSyncPoints';
66
77import { ActivateFlowProvider } from './Activate/ActivateFlow';
88import useActivateFlowState from './Activate/useActivateFlowState';
@@ -38,9 +38,7 @@ export default function Activate() {
3838 }, []);
3939
4040 // when we know the derived point, ensure we have the data to display it
41− useSyncKnownPoints(
42− [state.derivedPoint.getOrElse(null)].filter(p => p !== null)
43− );
41+ useSyncDates([state.derivedPoint.getOrElse(null)].filter(p => p !== null));
4442
4543 return (
4644 <LocalRouterProvider value={router}>
src/views/CreateGalaxy.js+2−2
@@ -29,7 +29,7 @@ import CopiableAddress from 'components/CopiableAddress';
2929
3030function useCreateGalaxy() {
3131 const { contracts } = useNetwork();
32− const { syncKnownPoint } = usePointCache();
32+ const { syncDates } = usePointCache();
3333
3434 const _contracts = need.contracts(contracts);
3535
@@ -43,7 +43,7 @@ function useCreateGalaxy() {
4343 },
4444 [_contracts]
4545 ),
46− useCallback(() => syncKnownPoint(galaxy), [galaxy, syncKnownPoint]),
46+ useCallback(() => syncDates(galaxy), [galaxy, syncDates]),
4747 GAS_LIMITS.DEFAULT
4848 );
4949}
src/views/IssueChild.js+2−5
@@ -34,7 +34,7 @@ import convertToInt from 'lib/convertToInt';
3434
3535function useIssueChild() {
3636 const { contracts } = useNetwork();
37− const { syncKnownPoint } = usePointCache();
37+ const { syncDates } = usePointCache();
3838
3939 const _contracts = need.contracts(contracts);
4040
@@ -48,10 +48,7 @@ function useIssueChild() {
4848 },
4949 [_contracts]
5050 ),
51− useCallback(() => syncKnownPoint(spawnedPoint), [
52− spawnedPoint,
53− syncKnownPoint,
54− ]),
51+ useCallback(() => syncDates(spawnedPoint), [spawnedPoint, syncDates]),
5552 GAS_LIMITS.DEFAULT
5653 );
5754}