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:
commit
9f058eb6af
1 changed files with 9 additions and 2 deletions
|
@ -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 };
|
||||||
|
|
Loading…
Reference in a new issue