@@ -1,4 +1,4 @@
1−import { useCallback, useEffect, useState } from 'react';
1+import { useCallback, useEffect, useState, useRef } from 'react';
22import { Just } from 'folktale/maybe';
33import { Grid, Flex } from 'indigo-react';
44import { Box, Icon, Row, Button, Checkbox } from '@tlon/indigo-react';
@@ -30,13 +30,16 @@ import Modal from 'components/L2/Modal';
3030import { isPlanet, isStar } from 'lib/utils/point';
3131import { useHasNetworkKeysSet } from 'lib/useHasNetworkKeysSet';
3232import { InviteForm } from './InviteForm';
33+import LoadingOverlay from 'components/L2/LoadingOverlay';
3334
3435export default function Point() {
3536 const { pop, push, names }: any = useLocalRouter();
3637 const { wallet }: any = useWallet();
3738 const { pointCursor }: any = usePointCursor();
3839 const point = need.point(pointCursor);
40+ const networkKeysSet = useHasNetworkKeysSet();
3941 const { syncExtras }: any = usePointCache();
42+
4043 const { api, getNumInvites, getPendingTransactions } = useRoller();
4144 const {
4245 pendingTransactions,
@@ -45,10 +48,13 @@ export default function Point() {
4548 setCurrentPoint,
4649 setInvites,
4750 } = useRollerStore();
48− const networkKeysSet = useHasNetworkKeysSet();
51+
4952 const [seenMissingKeys, setSeenMissingKeys] = useSeenMissingKeys();
5053 const [showModal, setShowModal] = useState(false);
5154 const [hideMessage, setHideMessage] = useState(false);
55+ const [loading, setLoading] = useState(false);
56+
57+ const pointRef = useRef<number | null>(null);
5258
5359 const hideModal = useCallback(() => {
5460 if (hideMessage) {
@@ -59,8 +65,11 @@ export default function Point() {
5965 }, [hideMessage, setShowModal, setSeenMissingKeys]);
6066
6167 useEffect(() => {
62− setShowModal(!networkKeysSet && !seenMissingKeys);
63− }, [networkKeysSet, seenMissingKeys]);
68+ if (pointRef.current !== point) {
69+ pointRef.current = point;
70+ setShowModal(!networkKeysSet && !seenMissingKeys);
71+ }
72+ }, [networkKeysSet, seenMissingKeys, point]);
6473
6574 const loadL1Info = useCallback(async () => {
6675 await syncExtras(point);
@@ -68,6 +77,7 @@ export default function Point() {
6877
6978 const loadL2Info = useCallback(async () => {
7079 const getTransactions = async () => {
80+ setLoading(true);
7181 const pointInfo = await api.getPoint(Number(point));
7282
7383 if (isDevelopment) {
@@ -76,10 +86,19 @@ export default function Point() {
7686 getPendingTransactions();
7787 setCurrentPoint(pointInfo);
7888 getNumInvites(isL2(pointInfo.dominion));
89+
90+ setTimeout(() => setLoading(false), 100);
7991 };
8092
8193 await getTransactions();
82− }, [api, point, getNumInvites, setCurrentPoint, getPendingTransactions]);
94+ }, [
95+ api,
96+ point,
97+ getNumInvites,
98+ setCurrentPoint,
99+ getPendingTransactions,
100+ setLoading,
101+ ]);
83102
84103 useEffect(() => {
85104 loadL1Info();
@@ -277,6 +296,7 @@ export default function Point() {
277296 </Row>
278297 </Box>
279298 </Modal>
299+ <LoadingOverlay loading={loading} />
280300 </View>
281301 );
282302}