@@ -13,12 +13,13 @@ import {
1313 submitL2Transaction,
1414 registerProxyAddress,
1515} from 'lib/utils/roller';
16−import { useCallback, useRef } from 'react';
16+import { useCallback } from 'react';
1717import { useNetwork } from 'store/network';
1818import { usePointCursor } from 'store/pointCursor';
1919import { useRollerStore } from 'store/rollerStore';
2020import {
2121 getStoredInvites,
22+ removeStoredInvite,
2223 setStoredInvite,
2324 setStoredInvites,
2425} from 'store/storage/roller';
@@ -170,21 +171,21 @@ export function useInvites() {
170171 const invite =
171172 storedInvite || (await generateInviteInfo(planet, _authToken));
172173
173− // TODO: check if the invite point's owner still matches the deterministic wallet address
174174 const planetInfo = await api.getPoint(planet);
175− setStoredInvite(ls, invite);
176−
175+ // unclaimed point: if still owned by the deterministic invite wallet
177176 if (
178177 invite.owner.toLowerCase() ===
179178 planetInfo.ownership?.owner?.address &&
180179 planetInfo.dominion === POINT_DOMINIONS.L2
181180 ) {
181+ setStoredInvite(ls, invite);
182182 addInvite(curPoint, invite);
183183 newInvites.push(invite);
184− }
185−
186− if (storedInvite) {
187− setStoredInvite(ls, invite);
184+ } else {
185+ // The point has been claimed, remove if it's in the cache
186+ if (storedInvite) {
187+ removeStoredInvite(ls, planet);
188+ }
188189 }
189190 }
190191
@@ -225,14 +226,8 @@ export function useInvites() {
225226 throw new Error('Internal Error: Missing Contracts/Web3/Wallet');
226227 }
227228
228− // TODO: remove when UI disables management proxy from spawning invites
229− // if (Just.hasInstance(authMnemonic)) {
230− // throw new Error(
231− // "Auth key Error: A management mnemonic can't create invite codes"
232− // );
233− // }
234−
235229 const invites: Invite[] = [];
230+ const storedInvites = getStoredInvites(ls);
236231
237232 const proxy = point.getSpawnProxy();
238233
@@ -249,6 +244,13 @@ export function useInvites() {
249244 const planet = planets[i];
250245 const nonceInc = i + nonce;
251246
247+ // When reticketing a planet in a browser that previously generated
248+ // the invite, we need to remove it from the cache.
249+ const storedInvite = storedInvites[planet];
250+ if (storedInvite) {
251+ removeStoredInvite(ls, planet);
252+ }
253+
252254 const { ticket, inviteWallet } = await generateInviteWallet(
253255 planet,
254256 _authToken