Fix a memory leak and loading on amber login

This commit is contained in:
Jon Staab
2024-11-18 16:14:57 -08:00
parent ae69da0be7
commit 165bfb1b2b
2 changed files with 12 additions and 10 deletions
+11 -9
View File
@@ -17,15 +17,17 @@
const signUp = () => pushModal(SignUp)
const withLoading = (cb: () => void) => async () => {
loading = true
const withLoading =
(cb: (...args: any[]) => any) =>
async (...args: any[]) => {
loading = true
try {
await cb()
} finally {
loading = false
try {
await cb(...args)
} finally {
loading = false
}
}
}
const onSuccess = async (session: Session, relays: string[] = []) => {
addSession(session)
@@ -50,7 +52,7 @@
}
})
const loginWithSigner = async (app: any) => {
const loginWithSigner = withLoading(async (app: any) => {
const signer = new Nip55Signer(app.packageName)
const pubkey = await signer.getPubkey()
@@ -62,7 +64,7 @@
message: "Something went wrong! Please try again.",
})
}
}
})
const loginWithBunker = () => pushModal(LogInBunker)
+1 -1
View File
@@ -209,7 +209,7 @@
})
// Listen for new notifications/memberships
subscribePersistent({
unsubRooms = subscribePersistent({
relays,
filters: [
{kinds: [THREAD], since},