Merge branch 'first-sign' into 'main'

useSignerStream: fix first event signing right after logging in

See merge request soapbox-pub/soapbox!2981
This commit is contained in:
Alex Gleason 2024-04-04 01:44:39 +00:00
commit 9f058eb6af

View file

@ -64,13 +64,20 @@ function useSignerStream() {
useEffect(() => { useEffect(() => {
if (!relay || !pubkey) return; if (!relay || !pubkey) return;
const controller = new AbortController();
const signal = controller.signal;
(async() => { (async() => {
for await (const msg of relay.req([{ kinds: [24133, 23194], authors: [pubkey], limit: 0 }])) { for await (const msg of relay.req([{ kinds: [24133, 23194], authors: [pubkey], limit: 0 }], { signal })) {
if (msg[0] === 'EVENT') handleEvent(msg[2]); if (msg[0] === 'EVENT') handleEvent(msg[2]);
} }
})(); })();
}, [relay, pubkey]); return () => {
controller.abort();
};
}, [relay, pubkey, signer]);
} }
export { useSignerStream }; export { useSignerStream };