Skip to content

Commit

Permalink
fix first time loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vivganes committed Nov 5, 2023
1 parent c775aa3 commit 32a36fe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/service/ndkprovider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,16 @@ export class NdkproviderService {
if (this.isNip07) {
await newNDK.assertSigner();
}
try {
await newNDK.connect(1000)
try {
const oldNDK = this.ndk;
oldNDK?.removeAllListeners();
newNDK.connect(1000)
.then(()=>{
console.log('ndk connected');
this.isTryingZapddit = false;
this.refreshAppData().then(() => {
console.log('refreshed app data')
this.ndk = newNDK;
this.loggingIn = false;
//once all setup is done, then only set loggedIn=true to start rendering
this.loggedIn = true;
Expand All @@ -409,7 +414,6 @@ export class NdkproviderService {

})
.catch(e => console.log(e));
this.ndk = newNDK;
} catch (e) {
console.log('Error in connecting NDK ' + e);
}
Expand Down

0 comments on commit 32a36fe

Please sign in to comment.