@@ -42,6 +42,7 @@ export default function InviteCohort() {
4242 currentL2,
4343 pendingTransactions,
4444 invites,
45+ setInvites,
4546 } = useRollerStore();
4647 const { generateInviteCodes, getPendingTransactions } = useRoller();
4748 const { pointCursor } = usePointCursor();
@@ -82,17 +83,22 @@ export default function InviteCohort() {
8283
8384 const invitePoint = possiblePoints.find(
8485 p =>
85− azimuth.azimuth.getPointSize(p) === azimuth.azimuth.PointSize.Planet
86+ azimuth.azimuth.getPointSize(p) ===
87+ azimuth.azimuth.PointSize.Planet &&
88+ !invites.find(({ planet }) => planet === p)
8689 );
8790
8891 if (invitePoint) {
8992 const { ticket, owner } = await wg.generateTemporaryDeterministicWallet(
90− point,
93+ invitePoint,
9194 _authToken
9295 );
9396
97+ console.log('INVITE POINT', invitePoint, owner.keys.address)
98+
9499 construct(invitePoint, owner.keys.address);
95100 setL1Invite({ ticket, planet: invitePoint });
101+ console.log(0, { ticket, planet: invitePoint })
96102 } else {
97103 setError('No available planets');
98104 }
@@ -101,6 +107,7 @@ export default function InviteCohort() {
101107 };
102108
103109 if (!currentL2 && _contracts && point && _authToken && showInviteForm) {
110+ console.log(1, 'NEW SETUP for L1')
104111 setUpInvite();
105112 } else {
106113 unconstruct();
@@ -113,19 +120,36 @@ export default function InviteCohort() {
113120 construct,
114121 showInviteForm,
115122 unconstruct,
123+ invites,
116124 ]);
117125
118− const l1Complete = useCallback(() => {
126+ useEffect(() => {
119127 const { available, pending, claimed } = getStoredInvites(point);
128+ console.log(2, completed, l1Invite)
129+
130+ if (
131+ !completed ||
132+ !l1Invite ||
133+ available.find(({ planet }) => planet === l1Invite.planet)
134+ ) {
135+ return;
136+ }
137+
138+ console.log(3, available)
139+
120140 setStoredInvites(point, {
121− available: [...available, l1Invite],
141+ available: [...invites, l1Invite],
122142 pending,
123143 claimed,
124144 });
125− setShowInviteForm(false);
126− }, [l1Invite, point]);
127145
128− useEffect(() => (completed ? l1Complete() : null), [completed, l1Complete]);
146+ console.log('SETTING', [...invites, l1Invite])
147+ setInvites([...invites, l1Invite]);
148+ // setShowInviteForm(false);
149+ // setL1Invite(null);
150+ unconstruct();
151+ pop();
152+ }, [completed]); // eslint-disable-line react-hooks/exhaustive-deps
129153
130154 const [page, setPage] = useState(0);
131155
@@ -290,7 +314,7 @@ export default function InviteCohort() {
290314 as={InlineEthereumTransaction}
291315 label="Generate Planet Code"
292316 {...bind}
293− onReturn={() => pop()}
317+ onReturn={pop}
294318 />
295319 )}
296320 </div>