@@ -1,4 +1,4 @@
1−import { useCallback, useEffect, useState } from 'react';
1+import { useCallback, useEffect, useState, useRef } from 'react';
2import { Just } from 'folktale/maybe';
2import { Just } from 'folktale/maybe';
3import { Grid, Flex } from 'indigo-react';
3import { Grid, Flex } from 'indigo-react';
4import { Box, Icon, Row, Button, Checkbox } from '@tlon/indigo-react';
4import { Box, Icon, Row, Button, Checkbox } from '@tlon/indigo-react';
@@ -30,13 +30,16 @@ import Modal from 'components/L2/Modal';
30import { isPlanet, isStar } from 'lib/utils/point';
30import { isPlanet, isStar } from 'lib/utils/point';
31import { useHasNetworkKeysSet } from 'lib/useHasNetworkKeysSet';
31import { useHasNetworkKeysSet } from 'lib/useHasNetworkKeysSet';
32import { InviteForm } from './InviteForm';
32import { InviteForm } from './InviteForm';
33+import LoadingOverlay from 'components/L2/LoadingOverlay';
34export default function Point() {
35export default function Point() {
35 const { pop, push, names }: any = useLocalRouter();
36 const { pop, push, names }: any = useLocalRouter();
36 const { wallet }: any = useWallet();
37 const { wallet }: any = useWallet();
37 const { pointCursor }: any = usePointCursor();
38 const { pointCursor }: any = usePointCursor();
38 const point = need.point(pointCursor);
39 const point = need.point(pointCursor);
40+ const networkKeysSet = useHasNetworkKeysSet();
39 const { syncExtras }: any = usePointCache();
41 const { syncExtras }: any = usePointCache();
40 const { api, getNumInvites, getPendingTransactions } = useRoller();
43 const { api, getNumInvites, getPendingTransactions } = useRoller();
42 pendingTransactions,
45 pendingTransactions,
@@ -45,10 +48,13 @@ export default function Point() {
45 setCurrentPoint,
48 setCurrentPoint,
46 setInvites,
49 setInvites,
47 } = useRollerStore();
50 } = useRollerStore();
48− const networkKeysSet = useHasNetworkKeysSet();
51+
49 const [seenMissingKeys, setSeenMissingKeys] = useSeenMissingKeys();
52 const [seenMissingKeys, setSeenMissingKeys] = useSeenMissingKeys();
50 const [showModal, setShowModal] = useState(false);
53 const [showModal, setShowModal] = useState(false);
51 const [hideMessage, setHideMessage] = useState(false);
54 const [hideMessage, setHideMessage] = useState(false);
55+ const [loading, setLoading] = useState(false);
57+ const pointRef = useRef<number | null>(null);
53 const hideModal = useCallback(() => {
59 const hideModal = useCallback(() => {
54 if (hideMessage) {
60 if (hideMessage) {
@@ -59,8 +65,11 @@ export default function Point() {
59 }, [hideMessage, setShowModal, setSeenMissingKeys]);
65 }, [hideMessage, setShowModal, setSeenMissingKeys]);
61 useEffect(() => {
67 useEffect(() => {
68+ if (pointRef.current !== point) {
69+ pointRef.current = point;
62− setShowModal(!networkKeysSet && !seenMissingKeys);
70+ setShowModal(!networkKeysSet && !seenMissingKeys);
63− }, [networkKeysSet, seenMissingKeys]);
72+ }, [networkKeysSet, seenMissingKeys, point]);
65 const loadL1Info = useCallback(async () => {
74 const loadL1Info = useCallback(async () => {
66 await syncExtras(point);
75 await syncExtras(point);
@@ -68,6 +77,7 @@ export default function Point() {
69 const loadL2Info = useCallback(async () => {
78 const loadL2Info = useCallback(async () => {
70 const getTransactions = async () => {
79 const getTransactions = async () => {
71 const pointInfo = await api.getPoint(Number(point));
81 const pointInfo = await api.getPoint(Number(point));
73 if (isDevelopment) {
83 if (isDevelopment) {
@@ -76,10 +86,19 @@ export default function Point() {
76 getPendingTransactions();
86 getPendingTransactions();
77 setCurrentPoint(pointInfo);
87 setCurrentPoint(pointInfo);
78 getNumInvites(isL2(pointInfo.dominion));
88 getNumInvites(isL2(pointInfo.dominion));
90+ setTimeout(() => setLoading(false), 100);
81 await getTransactions();
93 await getTransactions();
82− }, [api, point, getNumInvites, setCurrentPoint, getPendingTransactions]);
99+ getPendingTransactions,
84 useEffect(() => {
103 useEffect(() => {
85 loadL1Info();
104 loadL1Info();
@@ -277,6 +296,7 @@ export default function Point() {
299+ <LoadingOverlay loading={loading} />