Fix the pubkey like CHatGPT said

This commit is contained in:
Alex Gleason 2024-05-31 20:04:50 -05:00
parent 376090015e
commit 3adb570b4a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 11 additions and 2 deletions

View File

@ -14,9 +14,19 @@ function useSignerStream() {
const authStorageKey = `soapbox:nostr:auth:${pubkey}`;
useEffect(() => {
let isCancelled = false;
if (signer) {
signer.getPublicKey().then((pubkey) => setPubkey(pubkey)).catch(console.warn);
signer.getPublicKey().then((newPubkey) => {
if (!isCancelled) {
setPubkey(newPubkey);
}
}).catch(console.warn);
}
return () => {
isCancelled = true;
};
}, [signer]);
useEffect(() => {
@ -36,7 +46,6 @@ function useSignerStream() {
return () => {
connect.close();
};
}, [relay, signer, pubkey]);
}